add title replacement

master
Josha von Gizycki 6 years ago
parent bd6a63b258
commit b7f54b6941

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Equilibrium page</title>
<title>Equilibrium page &title</title>
</head>
<body>
<nav>

@ -1 +0,0 @@
jgizycki@Hastur.10236:1542010437

@ -95,16 +95,17 @@
(particles-in-content "asd &particle:hullu"))
(defn fill-in-placeholders [context html page]
(let [nav+content (-> html
(string/replace #"&nav" (:navcode context))
(string/replace #"&content" (:content page)))
particles (particles-in-content nav+content)]
(let [simple (-> html
(string/replace #"&nav" (:navcode context))
(string/replace #"&content" (:content page))
(string/replace #"&title" (get-in page [:metadata :title])))
particles (particles-in-content simple)]
(reduce (fn [result particle]
(println particle)
(string/replace result
(first particle)
(particle-content (second particle))))
nav+content
simple
particles)))
(comment
@ -129,7 +130,7 @@
(defn render
"Renders all markdown pages under resources/user using the structure in resources/user/structure to target/page"
[project]
(.mkdir (io/file "target/page"))
(.mkdirs (io/file "target/page"))
(let [sites (md-files (str input-root "/sites"))
rendered-sites (map analysed-page sites)
index-page (index-page)

Loading…
Cancel
Save