Enlive-style templates with Hiccup.
Enlive-style templates with Hiccup.
(accumulate & transformers)Takes a sequence of transformers as argument and returns a transformer that applies them all in order to a node, using the output of the previous as the input to the next.
Takes a sequence of transformers as argument and returns a transformer that applies them all in order to a node, using the output of the previous as the input to the next.
(append-content new-content)(apply-transform [select? transform] form)Given a transform (a selector function and a tranformation function), applies it where the selector dictates to the form given.
Given a transform (a selector function and a tranformation function), applies it where the selector dictates to the form given.
(apply-transforms transform-list forms)transform-list is a list of pairs of functions. The first in each pair is a selector function; it returns true if the node is one of interest. The second is the transformer function; it is applied to nodes whose selector is true. The argument forms is a list of hiccup forms to apply all the transformations to in order.
transform-list is a list of pairs of functions. The first in each pair is a selector function; it returns true if the node is one of interest. The second is the transformer function; it is applied to nodes whose selector is true. The argument forms is a list of hiccup forms to apply all the transformations to in order.
(attr= attr-name attr-value)Returns a function that returns true if the node has the given attribute with the given value.
Returns a function that returns true if the node has the given attribute with the given value.
(defsnippet tmpl-name source arg-list & transforms)(deftemplate tmpl-name source arg-list & transforms)(every-selector & selectors)Takes any number of selectors and returns a selector that is true if all of the argument selectors are true.
Takes any number of selectors and returns a selector that is true if all of the argument selectors are true.
(has-attr? attr-name)Returns a function that returns true if the node has the given attribute (with any value). Argument can be string/keyword/symbol.
Returns a function that returns true if the node has the given attribute (with any value). Argument can be string/keyword/symbol.
(has-class? class)Returns a function that returns true if the node has the given class.
Returns a function that returns true if the node has the given class.
(hiccup-file file-path)Parse hiccup forms out of the argument.
Parse hiccup forms out of the argument.
(html-document string-or-reader)Parse an HTML document out of the argument given, which can be either a string containing the HTML document, or a reader for that document.
Parse an HTML document out of the argument given, which can be either a string containing the HTML document, or a reader for that document.
(html-fragment string-or-reader)Parse an HTML fragment out of the argument given, which can be either a string containing the HTML fragment, or a reader for that fragment.
Parse an HTML fragment out of the argument given, which can be either a string containing the HTML fragment, or a reader for that fragment.
(id= id)Returns a function that returns true if the node has id equal to id.
Returns a function that returns true if the node has id equal to id.
(nth-child? n)Returns a function that returns true if the node is the nth child of its parent (and it has a parent). First element is 1, last is n.
Returns a function that returns true if the node is the nth child of its parent (and it has a parent). First element is 1, last is n.
(nth-last-child? n)Returns a function that returns true if the node is the nth last child of its parent (and it has a parent).
Returns a function that returns true if the node is the nth last child of its parent (and it has a parent).
(or-ancestor selector)Takes a selector as argument and returns a selector that will match any node for which either that node or some ancestor node in the tree matches the argument selector. Returns the loc of the matching ancestor node.
Takes a selector as argument and returns a selector that will match any node for which either that node or some ancestor node in the tree matches the argument selector. Returns the loc of the matching ancestor node.
(prepend-content new-content)(select & selectors)Takes any number of selectors as arguments and selects nodes that match the path down the tree specified. Returns the loc of the matched node.
Takes any number of selectors as arguments and selects nodes that match the path down the tree specified. Returns the loc of the matched node.
(set-attrs attr-map)(set-content new-content)(some-selector & selectors)Takes any number of selectors and returns a selector that is true if any of the argument selectors are true.
Takes any number of selectors and returns a selector that is true if any of the argument selectors are true.
(tag= tag)Returns a function that returns true if the node has tag equal to arg.
Returns a function that returns true if the node has tag equal to arg.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |