remove old doc func and fix md lists

This commit is contained in:
tristan 2024-01-03 14:56:48 +00:00
parent 93799cac12
commit 63f1c014af
6 changed files with 74 additions and 71 deletions

View file

@ -80,15 +80,6 @@ in
actual = List {} ["foo" "bar" "baz"];
asString = true;
})
(it "makes an html doc" {
expected = html.tag "html" {
__child = "";
class = [];
lang = "en";
} [(html.tag "head" {} ["foo"]) (html.tag "body" {} "bar")];
actual = Doc {} [["foo"] "bar"];
asString = true;
})
]
)
]

View file

@ -4,6 +4,7 @@
...
}: let
md = import ../nixite/md.nix;
html = import ../nixite/html.nix;
elems = import ../nixite/elems.nix;
in
with md; [
@ -16,6 +17,7 @@ in
''
];
expected = [(elems.List ["something"])];
asJSON = true;
})
(it "makes a list of many elements" {
@ -26,6 +28,7 @@ in
''
];
expected = [(elems.List ["something" "something else"])];
asJSON = true;
})
(it "makes a list of many checkboxes" {
@ -55,15 +58,7 @@ in
]
])
];
})
(it "matches a list with no whitespace around" {
actual = list [
''
- something
- something else''
];
expected = [(elems.List ["something" "something else"])];
asJSON = true;
})
(it "doesnt match not a list" (let
@ -80,16 +75,16 @@ in
actual = processStr ''
this text **may** *or may not* contain **bold** words *inside* it.
'';
expected = elems.p [
"this text"
(elems.strong "may")
expected = [(elems.p [
"this text "
(elems.strong "may") " "
(elems.em "or may not")
"contain"
" contain "
(elems.strong "bold")
"words"
" words "
(elems.em "inside")
"it."
];
" it."
])];
asString = true;
})
@ -119,9 +114,25 @@ in
(
describe "mdToPage" [
(it "converts markdown to a page" {
actual = toString (mdToPage ./blog/index.md) + "\n\n"; # inflation
expected = builtins.readFile ./out/index.html;
asString = true;
actual = mdToPage ''
# Markdown
This is *markdown*!
'';
expected = html.document {
head = [];
body = [
(elems.main (elems.article [
(elems.h1 "Markdown")
(elems.p [
"This is"
(elems.em "markdown")
"!"
])
]))
];
};
})
]
)