|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
(ns leiningen.render
|
|
|
|
|
(:require [clojure.java.io :as io]
|
|
|
|
|
[clojure.string :as string]
|
|
|
|
|
[markdown.core :as md]))
|
|
|
|
|
[markdown.core :as md])
|
|
|
|
|
(:import java.time.LocalDateTime))
|
|
|
|
|
|
|
|
|
|
(def input-root "resources/page")
|
|
|
|
|
|
|
|
|
@ -93,11 +94,15 @@
|
|
|
|
|
(comment
|
|
|
|
|
(particles-in-content "asd &particle:hullu"))
|
|
|
|
|
|
|
|
|
|
(defn now-str []
|
|
|
|
|
(.toString (LocalDateTime/now)))
|
|
|
|
|
|
|
|
|
|
(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 #"&title" (get-in page [:metadata :title]))
|
|
|
|
|
(string/replace #"&generated-at" (now-str)))
|
|
|
|
|
particles (particles-in-content simple)]
|
|
|
|
|
(reduce (fn [result particle]
|
|
|
|
|
(string/replace result
|
|
|
|
@ -110,6 +115,9 @@
|
|
|
|
|
(fill-in-placeholders {:navcode "hhh"}
|
|
|
|
|
"&nav &content &particle:aside\n "
|
|
|
|
|
{:content "dinge"})
|
|
|
|
|
(fill-in-placeholders {:navcode "hhh"}
|
|
|
|
|
"&nav &content &particle:aside\n &generated-at"
|
|
|
|
|
{:content "dinge"})
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defn write-sites [context template sites]
|
|
|
|
|