Heading support
This commit is contained in:
parent
72c73ec99d
commit
6263a02f89
10 changed files with 251 additions and 10 deletions
18
test/djotToHtml/002-headings/Main.idr
Normal file
18
test/djotToHtml/002-headings/Main.idr
Normal file
|
@ -0,0 +1,18 @@
|
|||
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 (_ ** blocks) = block contents
|
||||
let html = renderDocument blocks
|
||||
let output = render html
|
||||
putStrLn output
|
44
test/djotToHtml/002-headings/expected
Normal file
44
test/djotToHtml/002-headings/expected
Normal file
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang=en>
|
||||
<body>
|
||||
<h1>Level 1 Heading</h1>
|
||||
<h2>Level 2 Heading</h2>
|
||||
<h3>Level 3 Heading</h3>
|
||||
<h4>Level 4 Heading</h4>
|
||||
<h5>Level 5 Heading</h5>
|
||||
<h6>Level 6 Heading</h6>
|
||||
<p>####### Level 7 Not a heading</p>
|
||||
<h1>
|
||||
Multiline heading
|
||||
with prefix
|
||||
</h1>
|
||||
<h1>
|
||||
Multiline heading
|
||||
with prefix and some extra whitespace
|
||||
</h1>
|
||||
<h2>
|
||||
Level 2 multiline heading
|
||||
with prefix
|
||||
</h2>
|
||||
<h1>
|
||||
Multiline heading
|
||||
with no prefix
|
||||
</h1>
|
||||
<h2>
|
||||
Level 2 multiline heading
|
||||
with no prefix
|
||||
</h2>
|
||||
<h1>
|
||||
Unprefixed multiline heading
|
||||
with some indentation
|
||||
</h1>
|
||||
<h1>
|
||||
Heading level 1
|
||||
# With a level 2 right after it (this line shouldn't be a heading)
|
||||
</h1>
|
||||
<h2>
|
||||
Heading level 2
|
||||
With a level 1 right after it (this line shouldn't be a heading)
|
||||
</h2>
|
||||
</body>
|
||||
</html>
|
5
test/djotToHtml/002-headings/pack.toml
Normal file
5
test/djotToHtml/002-headings/pack.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[custom.all.SSG]
|
||||
type = "local"
|
||||
path = "../../.."
|
||||
ipkg = "SSG.ipkg"
|
||||
test = "test/test.ipkg"
|
6
test/djotToHtml/002-headings/run
Normal file
6
test/djotToHtml/002-headings/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/
|
38
test/djotToHtml/002-headings/test.dj
Normal file
38
test/djotToHtml/002-headings/test.dj
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Level 1 Heading
|
||||
|
||||
## Level 2 Heading
|
||||
|
||||
### Level 3 Heading
|
||||
|
||||
#### Level 4 Heading
|
||||
|
||||
##### Level 5 Heading
|
||||
|
||||
###### Level 6 Heading
|
||||
|
||||
####### Level 7 Not a heading
|
||||
|
||||
# Multiline heading
|
||||
# with prefix
|
||||
|
||||
# Multiline heading
|
||||
# with prefix and some extra whitespace
|
||||
|
||||
## Level 2 multiline heading
|
||||
## with prefix
|
||||
|
||||
|
||||
# Multiline heading
|
||||
with no prefix
|
||||
|
||||
## Level 2 multiline heading
|
||||
with no prefix
|
||||
|
||||
# Unprefixed multiline heading
|
||||
with some indentation
|
||||
|
||||
# Heading level 1
|
||||
## With a level 2 right after it (this line shouldn't be a heading)
|
||||
|
||||
## Heading level 2
|
||||
# With a level 1 right after it (this line shouldn't be a heading)
|
9
test/djotToHtml/002-headings/test.ipkg
Normal file
9
test/djotToHtml/002-headings/test.ipkg
Normal file
|
@ -0,0 +1,9 @@
|
|||
package a-test
|
||||
|
||||
depends = SSG
|
||||
, hedgehog
|
||||
, eff
|
||||
|
||||
main = Main
|
||||
|
||||
executable = test
|
Loading…
Add table
Add a link
Reference in a new issue