From 8c186f6e9145666cbabd5cca0a250d74a1e009d7 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Thu, 30 Dec 2021 03:45:24 -0800 Subject: Simplify file processing. --- webgen.janet | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/webgen.janet b/webgen.janet index 1b21544..922dba0 100644 --- a/webgen.janet +++ b/webgen.janet @@ -40,10 +40,8 @@ (defn process-html "Process the given HTML contents, applying the website's template." - [template variables path contents] - (substitute-variables variables path - (string/replace "${CONTENTS}" contents - template))) + [template contents] + (string/replace "${CONTENTS}" contents template)) (defn process-files "Process the files in the source directory and write the results to the @@ -61,8 +59,8 @@ (def processed-contents (match ext ".css" (substitute-variables variables src-filepath (filesystem/read-file src-filepath)) - ".html" (substitute-variables variables src-filepath process-html template (filesystem/read-file src-filepath)) - ".md" (substitute-variables variables src-filepath process-html template (markdown-file-to-html src-filepath)) + ".html" (substitute-variables variables src-filepath (process-html template (filesystem/read-file src-filepath))) + ".md" (substitute-variables variables src-filepath (process-html template (markdown-file-to-html src-filepath))) _ nil)) # nil means we copy the file as is. (var dst-filepath (string/replace src-dir build-dir src-filepath)) (set dst-filepath -- cgit v1.2.3