From 62f37497094a310a1db20c495e072d8072252a19 Mon Sep 17 00:00:00 2001 From: tristan Date: Sun, 11 Feb 2024 08:12:00 +0000 Subject: [PATCH] md to page callback --- nixite/md.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/nixite/md.nix b/nixite/md.nix index a466c80..25845f3 100644 --- a/nixite/md.nix +++ b/nixite/md.nix @@ -7,13 +7,13 @@ in rec { then processStr (builtins.readFile md) else processStr md; - recReadMd = root: + recReadMd = toPage: root: assert builtins.isPath root; builtins.mapAttrs (path: type: if type == "directory" then recReadMd (root + (/. + path)) else if type == "regular" - then mdToPage (root + (/. + path)) + then toPage (processMd (root + (/. + path))) else throw "Cannot read ${path}, file type ${type}") (builtins.readDir root); recFixAppendix = site: @@ -28,13 +28,7 @@ in rec { fixAppendix = builtins.replaceStrings [".md"] [".html"]; - readDir = root: recFixAppendix (recReadMd root); - - mdToPage = md: - html.document { - head = []; - body = elems.main (elems.article (processMd md)); - }; + readDir = toPage: root: recFixAppendix (recReadMd toPage root); splitList = block: map listItem (builtins.filter (s: builtins.isString s && s != "")