site.fabricate.prototype.read Namespace

Parsing + evaluation utilities for embedded Clojure forms. The functions in this namespace split the text into a sequence of Hiccup forms and embedded expressions, which is then traversed again to evaluate it, embedding (or not) the results of those expressions within the Hiccup document.

The grammar of page templates is defined in the site.fabricate.prototype.read.grammar namespace. This namespace builds on that one to walk through the parse tree of Clojure expressions produced by the template grammar and evaluate them.

An overview of the template grammar with examples is provided in the page A Reference to Fabricate's Page Templates.

Functions


Error
Error type
class clojure.lang.Compiler$CompilerException
Error message
No such var: page/expr->hiccup
Error phase
:compile-syntax-check
Location
Lines 24-38, Columns 1-28
Source expression
 [:div (->> vars
         (filter (fn [[k v]] (fn? (var-get v))))
         (reduce (fn [l [k v]]
(conj l [:dt [:code {:class "language-clojure symbol"} k]]
      [:dd [:dl
            [:dt "Description" ]
            [:dd (:doc (meta v))]
            [:dt "Arguments"]
            [:dd
             (apply conj [:ul {:style (garden/style {:list-style-type "none"})}]
                    (map (fn [a]
                           [:li [:code {:class "language-clojure"}
                                 (page/expr->hiccup a)]])
                         (:arglists (meta v))))]]]))
                 [:dl]))]


Constants


Error
Error type
class clojure.lang.Compiler$CompilerException
Error message
No such var: page/expr->hiccup
Error phase
:compile-syntax-check
Location
Lines 42-49, Columns 1-28
Source expression
 [:div (->> vars
         (filter (fn [[k v]] (not (fn? (var-get v)))))
         (reduce (fn [l [k v]]
(conj l [:dt [:code {:class "language-clojure symbol"} k]]
      [:dd [:dl [:dt "Description"] [:dd (:doc (meta v))]
            [:dt "Type"]
            [:dd [:code (page/expr->hiccup (type (var-get v)))]]]]))
                 [:dl]))]