better testing experience

This commit is contained in:
tristan 2024-01-02 04:01:19 +00:00
parent 4f28cbfda7
commit 9421a0a910
10 changed files with 96 additions and 49 deletions

View file

@ -69,25 +69,31 @@ in rec {
matchThen "(```)(.*)(```)" block (m: elems.code (builtins.elemAt m 1));
list = block:
matchThen (
''
matchThen (''
(- .+
)*(- .+
?)'') block (m:
elems.List ( splitList block ));
?)'') block (m: elems.List (splitList block));
splitList = block: map (listItem) (builtins.filter
(s: builtins.isString s && s != "")
(builtins.split "\n" block));
splitList = block:
map (listItem) (builtins.filter (s: builtins.isString s && s != "")
(builtins.split "\n" block));
listItem = str:
listItem = str:
let
li = builtins.match "- (.*)" str;
checkbox = builtins.match "- \\[(.)] (.*)" str;
checked = builtins.elemAt checkbox 0;
content = builtins.elemAt checkbox 1;
in if checkbox == null then li else
[(elems.input {type = "checkbox"; checked = checked != " "; disabled = true;}) content];
li = builtins.match "- (.*)" str;
checkbox = builtins.match "- \\[(.)] (.*)" str;
checked = builtins.elemAt checkbox 0;
content = builtins.elemAt checkbox 1;
in if checkbox == null then
li
else [
(elems.input {
type = "checkbox";
checked = checked != " ";
disabled = true;
})
content
];
replace = matcher: apply: block:
(let