md to page callback
This commit is contained in:
parent
3c82f5f9bc
commit
62f3749709
|
@ -7,13 +7,13 @@ in rec {
|
||||||
then processStr (builtins.readFile md)
|
then processStr (builtins.readFile md)
|
||||||
else processStr md;
|
else processStr md;
|
||||||
|
|
||||||
recReadMd = root:
|
recReadMd = toPage: root:
|
||||||
assert builtins.isPath root;
|
assert builtins.isPath root;
|
||||||
builtins.mapAttrs (path: type:
|
builtins.mapAttrs (path: type:
|
||||||
if type == "directory"
|
if type == "directory"
|
||||||
then recReadMd (root + (/. + path))
|
then recReadMd (root + (/. + path))
|
||||||
else if type == "regular"
|
else if type == "regular"
|
||||||
then mdToPage (root + (/. + path))
|
then toPage (processMd (root + (/. + path)))
|
||||||
else throw "Cannot read ${path}, file type ${type}") (builtins.readDir root);
|
else throw "Cannot read ${path}, file type ${type}") (builtins.readDir root);
|
||||||
|
|
||||||
recFixAppendix = site:
|
recFixAppendix = site:
|
||||||
|
@ -28,13 +28,7 @@ in rec {
|
||||||
|
|
||||||
fixAppendix = builtins.replaceStrings [".md"] [".html"];
|
fixAppendix = builtins.replaceStrings [".md"] [".html"];
|
||||||
|
|
||||||
readDir = root: recFixAppendix (recReadMd root);
|
readDir = toPage: root: recFixAppendix (recReadMd toPage root);
|
||||||
|
|
||||||
mdToPage = md:
|
|
||||||
html.document {
|
|
||||||
head = [];
|
|
||||||
body = elems.main (elems.article (processMd md));
|
|
||||||
};
|
|
||||||
|
|
||||||
splitList = block:
|
splitList = block:
|
||||||
map listItem (builtins.filter (s: builtins.isString s && s != "")
|
map listItem (builtins.filter (s: builtins.isString s && s != "")
|
||||||
|
|
Loading…
Reference in a new issue