|
|
@ -25,22 +25,6 @@
|
|
|
|
(defn index-template []
|
|
|
|
(defn index-template []
|
|
|
|
(slurp (str input-root "/index.html")))
|
|
|
|
(slurp (str input-root "/index.html")))
|
|
|
|
|
|
|
|
|
|
|
|
(comment
|
|
|
|
|
|
|
|
(defn navcode [sites]
|
|
|
|
|
|
|
|
(let [sorted-sites (sort-by #(core/filename %) sites)
|
|
|
|
|
|
|
|
clean-file-name-fn #(core/clean-name (core/filename %))
|
|
|
|
|
|
|
|
nav-line-fn #(str "<li>"
|
|
|
|
|
|
|
|
"<a href=\""
|
|
|
|
|
|
|
|
(clean-file-name-fn %)
|
|
|
|
|
|
|
|
".html\">"
|
|
|
|
|
|
|
|
(clean-file-name-fn %)
|
|
|
|
|
|
|
|
"</a></li>")]
|
|
|
|
|
|
|
|
(str "<ol>"
|
|
|
|
|
|
|
|
(reduce #(str %1 (nav-line-fn %2))
|
|
|
|
|
|
|
|
""
|
|
|
|
|
|
|
|
sorted-sites)
|
|
|
|
|
|
|
|
"</ol>"))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn site-destination [filename]
|
|
|
|
(defn site-destination [filename]
|
|
|
|
(str output-root
|
|
|
|
(str output-root
|
|
|
|
"/"
|
|
|
|
"/"
|
|
|
@ -129,36 +113,8 @@
|
|
|
|
(comment
|
|
|
|
(comment
|
|
|
|
(particle-content "aside"))
|
|
|
|
(particle-content "aside"))
|
|
|
|
|
|
|
|
|
|
|
|
(defn blog-sites-preview [blog-name]
|
|
|
|
|
|
|
|
(reduce (fn [res site]
|
|
|
|
|
|
|
|
(let [content (:content site)
|
|
|
|
|
|
|
|
divider-pos (string/index-of content "<p><blink></p>")
|
|
|
|
|
|
|
|
length (count content)
|
|
|
|
|
|
|
|
end (or divider-pos length)
|
|
|
|
|
|
|
|
pre-content (subs content 0 end)
|
|
|
|
|
|
|
|
article-link (str "<a href=\""
|
|
|
|
|
|
|
|
(:link site)
|
|
|
|
|
|
|
|
"\">"
|
|
|
|
|
|
|
|
"↪"
|
|
|
|
|
|
|
|
(when divider-pos
|
|
|
|
|
|
|
|
"…")
|
|
|
|
|
|
|
|
"</a>")]
|
|
|
|
|
|
|
|
(str res
|
|
|
|
|
|
|
|
"<article>"
|
|
|
|
|
|
|
|
pre-content
|
|
|
|
|
|
|
|
"<p class=\"article-link\">"
|
|
|
|
|
|
|
|
article-link
|
|
|
|
|
|
|
|
"</p>"
|
|
|
|
|
|
|
|
"</article>")))
|
|
|
|
|
|
|
|
""
|
|
|
|
|
|
|
|
(->> blog-name
|
|
|
|
|
|
|
|
blog-sites
|
|
|
|
|
|
|
|
(take-last 5)
|
|
|
|
|
|
|
|
reverse)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn fill-in-placeholders [html page]
|
|
|
|
(defn fill-in-placeholders [html page]
|
|
|
|
(let [simple (-> html
|
|
|
|
(let [simple (-> html
|
|
|
|
;; (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)))
|
|
|
@ -171,18 +127,14 @@
|
|
|
|
(first particle)
|
|
|
|
(first particle)
|
|
|
|
(particle-content (second particle))))
|
|
|
|
(particle-content (second particle))))
|
|
|
|
blog-sites-fn (fn [result [match-str blog-name]]
|
|
|
|
blog-sites-fn (fn [result [match-str blog-name]]
|
|
|
|
(string/replace
|
|
|
|
(let [sites (blog-sites blog-name)]
|
|
|
|
result
|
|
|
|
(string/replace result
|
|
|
|
match-str
|
|
|
|
match-str
|
|
|
|
(blog-sites-preview blog-name)))
|
|
|
|
(blog/sites-preview sites))))
|
|
|
|
envs-fn (fn [result [match-str env-name]]
|
|
|
|
envs-fn (fn [result [match-str env-name]]
|
|
|
|
(when (= nil (System/getenv env-name))
|
|
|
|
|
|
|
|
(throw (ex-info (str "env var not found " env-name)
|
|
|
|
|
|
|
|
{:env-var env-name
|
|
|
|
|
|
|
|
:match-str match-str})))
|
|
|
|
|
|
|
|
(string/replace result
|
|
|
|
(string/replace result
|
|
|
|
match-str
|
|
|
|
match-str
|
|
|
|
(System/getenv env-name)))]
|
|
|
|
(core/env-val env-name)))]
|
|
|
|
(as-> simple $
|
|
|
|
(as-> simple $
|
|
|
|
(reduce particle-fn $ particles)
|
|
|
|
(reduce particle-fn $ particles)
|
|
|
|
(reduce blog-sites-fn $ last-blog-sites)
|
|
|
|
(reduce blog-sites-fn $ last-blog-sites)
|
|
|
|