diff --git a/resources/page/index.html b/resources/page/index.html index a326125..c437270 100644 --- a/resources/page/index.html +++ b/resources/page/index.html @@ -1,17 +1,19 @@ - Equilibrium page &title + + + Equilibrium page &:title
- &content + &:content
diff --git a/src/leiningen/render.clj b/src/leiningen/render.clj index 98d5fd2..a23d13e 100644 --- a/src/leiningen/render.clj +++ b/src/leiningen/render.clj @@ -89,7 +89,7 @@ (page-content "aiaiaiai")) (defn particles-in-content [content] - (re-seq #"&particle:([^\s]+)" content)) + (re-seq #"&:particle:([^\s]+)" content)) (comment (particles-in-content "asd &particle:hullu")) @@ -99,10 +99,10 @@ (defn fill-in-placeholders [context html page] (let [simple (-> html - (string/replace #"&nav" (:navcode context)) - (string/replace #"&content" (:content page)) - (string/replace #"&title" (get-in page [:metadata :title])) - (string/replace #"&generated-at" (now-str))) + (string/replace #"&:nav" (:navcode context)) + (string/replace #"&:content" (:content page)) + (string/replace #"&:title" (get-in page [:metadata :title])) + (string/replace #"&:generated-at" (now-str))) particles (particles-in-content simple)] (reduce (fn [result particle] (string/replace result @@ -113,10 +113,10 @@ (comment (fill-in-placeholders {:navcode "hhh"} - "&nav &content &particle:aside\n " + "&:nav &content &:particle:aside\n " {:content "dinge"}) (fill-in-placeholders {:navcode "hhh"} - "&nav &content &particle:aside\n &generated-at" + "&:nav &:content &:particle:aside\n &:generated-at" {:content "dinge"}) ) @@ -133,9 +133,18 @@ :content (-> content page-content render-markdown) :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 "Renders all markdown pages under resources/user using the structure in resources/user/structure to target/page" [project] + (clear-dir (io/file "target/page")) (.mkdirs (io/file "target/page")) (let [sites (md-files (str input-root "/sites")) rendered-sites (map analysed-page sites)