Back
compile-html-with-bindings (clj)
(source)function
(compile-html-with-bindings & content)
Pre-compile data structures into HTML where possible, while taking into
account bindings that modify the result like *html-mode*.
Examples
weavejester/hiccup
(ns hiccup2.core
"Library for rendering a tree of vectors into HTML. Pre-compiles where
possible for performance. Strings are automatically escaped."
{:added "2.0"}
(:require [hiccup.compiler :as compiler]
[hiccup.util :as util]))
`:escape-strings?`
: True if strings should be escaped (defaults to true)."
{:added "2.0"}
[options & content]
(if (map? options)
(let [mode (:mode options :xhtml)
escape-strings? (:escape-strings? options true)]
`(binding [util/*html-mode* ~mode
util/*escape-strings?* ~escape-strings?]
(util/raw-string ~(apply compiler/compile-html-with-bindings content))))
`(util/raw-string ~(apply compiler/compile-html-with-bindings options content))))