Test linebreaks and nbsps
This commit is contained in:
parent
72b102d071
commit
85ead54619
7 changed files with 132 additions and 11 deletions
16
test/djot-to-html/002-linebreaks-and-nbsp/Main.idr
Normal file
16
test/djot-to-html/002-linebreaks-and-nbsp/Main.idr
Normal file
|
@ -0,0 +1,16 @@
|
|||
module Main
|
||||
|
||||
import SSG.Djot
|
||||
import SSG.HTML
|
||||
|
||||
import System
|
||||
import System.File
|
||||
|
||||
main : IO ()
|
||||
main = do
|
||||
Right contents <- readFile "test.dj"
|
||||
| Left err => do
|
||||
printLn err
|
||||
exitFailure
|
||||
let parsed = djot contents
|
||||
putStr . render . renderHtml $ parsed
|
26
test/djot-to-html/002-linebreaks-and-nbsp/expected
Normal file
26
test/djot-to-html/002-linebreaks-and-nbsp/expected
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang=en>
|
||||
<body>
|
||||
<p>A paragraph with a normal newline in the middle of it</p>
|
||||
<p>
|
||||
A paragraph with a hard line break
|
||||
<br>
|
||||
in the middle of it
|
||||
</p>
|
||||
<p>
|
||||
A paragraph with a hard line break
|
||||
<br>
|
||||
in the middle of it with extra spaces
|
||||
</p>
|
||||
<p>
|
||||
A paragraph with a hard line break
|
||||
<br>
|
||||
in the middle of it with no spaces
|
||||
</p>
|
||||
<p>A paragraph with an explicit soft line break in the middle of it</p>
|
||||
<p>Multiple soft breaks should coalesce into one</p>
|
||||
<p>Same should apply when mixing explicit and implied soft breaks</p>
|
||||
<p>An escaped space should render as a nonbreaking space</p>
|
||||
<p>We also want to test multiple nonbreaking spaces in a row</p>
|
||||
</body>
|
||||
</html>
|
6
test/djot-to-html/002-linebreaks-and-nbsp/run
Normal file
6
test/djot-to-html/002-linebreaks-and-nbsp/run
Normal file
|
@ -0,0 +1,6 @@
|
|||
rm -rf build/
|
||||
|
||||
flock "$1" pack -q install-deps test.ipkg
|
||||
pack -q run test.ipkg
|
||||
|
||||
rm -rf build/
|
22
test/djot-to-html/002-linebreaks-and-nbsp/test.dj
Normal file
22
test/djot-to-html/002-linebreaks-and-nbsp/test.dj
Normal file
|
@ -0,0 +1,22 @@
|
|||
A paragraph with a normal newline
|
||||
in the middle of it
|
||||
|
||||
A paragraph with a hard line break \
|
||||
in the middle of it
|
||||
|
||||
A paragraph with a hard line break \
|
||||
in the middle of it with extra spaces
|
||||
|
||||
A paragraph with a hard line break \
|
||||
in the middle of it with no spaces
|
||||
|
||||
A paragraph with an explicit soft line break \n in the middle of it
|
||||
|
||||
Multiple soft breaks should coalesce \n\n\n into one
|
||||
|
||||
Same should apply when mixing explicit \n
|
||||
and implied soft breaks
|
||||
|
||||
An escaped space\ should render as a nonbreaking space
|
||||
|
||||
We also want to test\ \ multiple\ \ \ nonbreaking\ \ \ \ spaces\ \ \ \ \ in a row
|
7
test/djot-to-html/002-linebreaks-and-nbsp/test.ipkg
Normal file
7
test/djot-to-html/002-linebreaks-and-nbsp/test.ipkg
Normal file
|
@ -0,0 +1,7 @@
|
|||
package a-test
|
||||
|
||||
depends = SSG
|
||||
|
||||
main = Main
|
||||
|
||||
executable = test
|
Loading…
Add table
Add a link
Reference in a new issue