Safe Haskell | None |
---|---|
Language | Haskell98 |
Documentation
bindJson :: (ToJSON a, Monad n) => a -> Splice n Source #
This splice binds convenience tags for the given JSON (or JSON-convertible) value and runs the tag's child nodes using the new bindings.
Tags bound when you pass in an object
Tags bound for an object looking like this:
{ "k_1": v_1, ..., "k_N": v_N }
<value:{k_i}>
-- treats v_i as text
<snippet:{k_i}>
-- treats v_i as HTML
<with:{k_i}>
-- explodes v_i and runs its children
<value var="foo.bar.baz"/>
-- walks the JSON tree to find
"foo.bar.baz", and interprets it as a string
<snippet var="foo.bar.baz"/>
<with var="foo.bar.baz">...<with>
Tags bound when you pass in anything else
<value/>
-- the given JSON value, as a string
<snippet/>
-- the given JSON value, parsed and spliced in as HTML