Liking cljdoc? Tell your friends :D

selmer.filter-parser

Accessors are separated by dots like {{ foo.bar.0 }} which gets translated into (get-in context-map [:foo :bar 0]). So you can nest vectors and maps in your context-map.

Filters can be applied by separating then from the accessor with pipes: {{ foo|lower|capitalize }}. They are applied one after the other from left to right. Arguments can be passed to a filter separated by colons: {{ foo|pluralize:y:ies }}. If an argument includes spaces you can enclose it with doublequotes or colons: {{ foo|join:", " }}.

You can escape doublequotes inside doublequotes. And you can put colons inside doublequotes which will be ignored for the purpose of separating arguments.

Accessors are separated by dots like {{ foo.bar.0 }}
which gets translated into (get-in context-map [:foo :bar 0]). So you
can nest vectors and maps in your context-map.

Filters can be applied by separating then from the accessor
with pipes: {{ foo|lower|capitalize }}. They are applied one after
the other from left to right. Arguments can be passed to a filter
separated by colons: {{ foo|pluralize:y:ies }}. If an argument includes
spaces you can enclose it with doublequotes or colons: {{ foo|join:", " }}.

You can escape doublequotes inside doublequotes. And you can put colons
inside doublequotes which will be ignored for the purpose of separating
arguments.
raw docstring

compile-filter-bodyclj

(compile-filter-body s)
(compile-filter-body s escape?)

Turns a string like foo|filter1:x|filter2:y into a fn that expects a context-map and will apply the filters one after the other to the value from the map. It will escape the end result unless the last filter is "safe" or when it's called with escape? equal to true, which is the default behavior.

Turns a string like foo|filter1:x|filter2:y into a fn that expects a
context-map and will apply the filters one after the other to the value
from the map. It will escape the end result unless the last
filter is "safe" or when it's called with escape? equal to true,
which is the default behavior.
raw docstring

escape-htmlclj

(escape-html x)

Must have the form [:safe safe-string] to prevent escaping. Alternatively, you can call selmer.util/turn-off-escaping! to turn it off completely.

If it is marked as :safe, the value will be returned as-is, otherwise it will be converted to a string even if it is not escaped.

Must have the form [:safe safe-string] to prevent escaping. Alternatively,
you can call selmer.util/turn-off-escaping! to turn it off completely.

If it is marked as :safe, the value will be returned as-is, otherwise it
will be converted to a string even if it is not escaped.
raw docstring

escape-html*clj

(escape-html* s)

HTML-escapes the given string. Escapes the same characters as django's escape.

HTML-escapes the given string. Escapes the same characters as django's escape.
raw docstring

filter-str->fnclj

(filter-str->fn s)

Turns a filter string like "pluralize:y:ies" into a function that expects a value obtained from a context map or from a previously applied filter.

Turns a filter string like "pluralize:y:ies" into a function that
expects a value obtained from a context map or from a previously
applied filter.
raw docstring

fix-filter-argsclj

(fix-filter-args args)

Map any sort of needed fixes to the arguments before passing them to the filters. Only strips enclosing doublequotes for now.

Map any sort of needed fixes to the arguments before passing them
to the filters. Only strips enclosing doublequotes for now.
raw docstring

get-accessorclj

(get-accessor m k)

Returns the value of k from map m, either as a keyword or string lookup.

Returns the value of `k` from map `m`, either as a keyword or string lookup.
raw docstring

literal?clj

(literal? val)

lookup-argsclj

(lookup-args context-map)

Given a context map, return a function that accepts a filter argument and if it begins with @, return the value from the context map instead of treating it as a literal.

Given a context map, return a function that accepts a filter
argument and if it begins with @, return the value from the
context map instead of treating it as a literal.
raw docstring

parse-literalclj

(parse-literal val)

safe-filterclj


split-valueclj

(split-value s)

strip-doublequotesclj

(strip-doublequotes s)

Removes doublequotes from the start and end of a string if any.

Removes doublequotes from the start and end of a string if any.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close