|
|
@ -89,7 +89,7 @@
|
|
|
|
(page-content "aiaiaiai"))
|
|
|
|
(page-content "aiaiaiai"))
|
|
|
|
|
|
|
|
|
|
|
|
(defn particles-in-content [content]
|
|
|
|
(defn particles-in-content [content]
|
|
|
|
(re-seq #"&particle:([^\s]+)" content))
|
|
|
|
(re-seq #"&:particle:([^\s]+)" content))
|
|
|
|
|
|
|
|
|
|
|
|
(comment
|
|
|
|
(comment
|
|
|
|
(particles-in-content "asd &particle:hullu"))
|
|
|
|
(particles-in-content "asd &particle:hullu"))
|
|
|
@ -99,10 +99,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
(defn fill-in-placeholders [context html page]
|
|
|
|
(defn fill-in-placeholders [context html page]
|
|
|
|
(let [simple (-> html
|
|
|
|
(let [simple (-> html
|
|
|
|
(string/replace #"&nav" (:navcode context))
|
|
|
|
(string/replace #"&:nav" (:navcode context))
|
|
|
|
(string/replace #"&content" (:content page))
|
|
|
|
(string/replace #"&:content" (:content page))
|
|
|
|
(string/replace #"&title" (get-in page [:metadata :title]))
|
|
|
|
(string/replace #"&:title" (get-in page [:metadata :title]))
|
|
|
|
(string/replace #"&generated-at" (now-str)))
|
|
|
|
(string/replace #"&:generated-at" (now-str)))
|
|
|
|
particles (particles-in-content simple)]
|
|
|
|
particles (particles-in-content simple)]
|
|
|
|
(reduce (fn [result particle]
|
|
|
|
(reduce (fn [result particle]
|
|
|
|
(string/replace result
|
|
|
|
(string/replace result
|
|
|
@ -113,10 +113,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
(comment
|
|
|
|
(comment
|
|
|
|
(fill-in-placeholders {:navcode "hhh"}
|
|
|
|
(fill-in-placeholders {:navcode "hhh"}
|
|
|
|
"&nav &content &particle:aside\n "
|
|
|
|
"&:nav &content &:particle:aside\n "
|
|
|
|
{:content "dinge"})
|
|
|
|
{:content "dinge"})
|
|
|
|
(fill-in-placeholders {:navcode "hhh"}
|
|
|
|
(fill-in-placeholders {:navcode "hhh"}
|
|
|
|
"&nav &content &particle:aside\n &generated-at"
|
|
|
|
"&:nav &:content &:particle:aside\n &:generated-at"
|
|
|
|
{:content "dinge"})
|
|
|
|
{:content "dinge"})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -133,9 +133,18 @@
|
|
|
|
:content (-> content page-content render-markdown)
|
|
|
|
:content (-> content page-content render-markdown)
|
|
|
|
:metadata (page-metadata content)}))
|
|
|
|
:metadata (page-metadata content)}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn clear-dir [dir]
|
|
|
|
|
|
|
|
(doseq [file (file-seq dir)]
|
|
|
|
|
|
|
|
(when (.exists dir)
|
|
|
|
|
|
|
|
(when (and (.isDirectory file)
|
|
|
|
|
|
|
|
(not= dir file))
|
|
|
|
|
|
|
|
(clear-dir file))
|
|
|
|
|
|
|
|
(.delete file))))
|
|
|
|
|
|
|
|
|
|
|
|
(defn render
|
|
|
|
(defn render
|
|
|
|
"Renders all markdown pages under resources/user using the structure in resources/user/structure to target/page"
|
|
|
|
"Renders all markdown pages under resources/user using the structure in resources/user/structure to target/page"
|
|
|
|
[project]
|
|
|
|
[project]
|
|
|
|
|
|
|
|
(clear-dir (io/file "target/page"))
|
|
|
|
(.mkdirs (io/file "target/page"))
|
|
|
|
(.mkdirs (io/file "target/page"))
|
|
|
|
(let [sites (md-files (str input-root "/sites"))
|
|
|
|
(let [sites (md-files (str input-root "/sites"))
|
|
|
|
rendered-sites (map analysed-page sites)
|
|
|
|
rendered-sites (map analysed-page sites)
|
|
|
|