aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--webgen.janet10
1 files 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 @@
40 40
41(defn process-html 41(defn process-html
42 "Process the given HTML contents, applying the website's template." 42 "Process the given HTML contents, applying the website's template."
43 [template variables path contents] 43 [template contents]
44 (substitute-variables variables path 44 (string/replace "${CONTENTS}" contents template))
45 (string/replace "${CONTENTS}" contents
46 template)))
47 45
48(defn process-files 46(defn process-files
49 "Process the files in the source directory and write the results to the 47 "Process the files in the source directory and write the results to the
@@ -61,8 +59,8 @@
61 (def processed-contents 59 (def processed-contents
62 (match ext 60 (match ext
63 ".css" (substitute-variables variables src-filepath (filesystem/read-file src-filepath)) 61 ".css" (substitute-variables variables src-filepath (filesystem/read-file src-filepath))
64 ".html" (substitute-variables variables src-filepath process-html template (filesystem/read-file src-filepath)) 62 ".html" (substitute-variables variables src-filepath (process-html template (filesystem/read-file src-filepath)))
65 ".md" (substitute-variables variables src-filepath process-html template (markdown-file-to-html src-filepath)) 63 ".md" (substitute-variables variables src-filepath (process-html template (markdown-file-to-html src-filepath)))
66 _ nil)) # nil means we copy the file as is. 64 _ nil)) # nil means we copy the file as is.
67 (var dst-filepath (string/replace src-dir build-dir src-filepath)) 65 (var dst-filepath (string/replace src-dir build-dir src-filepath))
68 (set dst-filepath 66 (set dst-filepath