Cybermonday pairs well with templating, but context is very important. Cybermonday itself doesn't provide any templating abilities, there are many excellent libraries out there for that such as pogonos for mustache.
For example, mustache could be used in two ways:
The former has the use case of systematically creating markdown documents while the latter is more of templating small parts of the document.
In the latter, you might want to blacklist some tags and only process text in certain places, this can easily be accomplished with:
(defn process-template [mdast template-vals]
(clojure.walk/prewalk
(fn [item]
(if (cybermonday.utils/hiccup? item)
(let [[tag attrs & body] item]
(if (not= tag :code)
(cybermonday.utils/make-hiccup-node
tag
attrs
(map #(if (string? %)
(pogonos.core/render-string % template-vals)
%)
body))
item))
item))
mdast))
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close