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.
sourceraw 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.
sourceraw 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.
sourceraw 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.
sourceraw 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.
sourceraw 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.
sourceraw docstring

literal?clj

(literal? val)
source

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.
sourceraw docstring

safe-filterclj

source

split-valueclj

(split-value s)
source

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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close