Parsing and handling of compile-time vs. run-time. Avoiding unnecessary work by pre-processing the template structure and content and reacting to the runtime context map with a prepared data structure instead of a raw template. Anything other than a raw tag value injection is a runtime dispatch fn. Compile-time here means the first time we see a template at runtime, not the implementation's compile-time.
Parsing and handling of compile-time vs. run-time. Avoiding unnecessary work by pre-processing the template structure and content and reacting to the runtime context map with a prepared data structure instead of a raw template. Anything other than a raw tag value injection is a runtime dispatch fn. Compile-time here means the first time we see a template *at runtime*, not the implementation's compile-time.
(<< s)
Resolves the variables from your template string from the local-env, or the namespace and puts them into your template for you.
e.g. (let [a 1] (<< "{{a}} + {{a}} = 2")) ;;=> "1 + 1 = 2"
Resolves the variables from your template string from the local-env, or the namespace and puts them into your template for you. e.g. (let [a 1] (<< "{{a}} + {{a}} = 2")) ;;=> "1 + 1 = 2"
(add-tag! k handler & tags)
tag name, fn handler, and maybe tags
tag name, fn handler, and maybe tags
(ensure-list list-maybe)
Turns the argument into a list if it isn't a list already.
Turns the argument into a list if it isn't a list already.
(filter-tag {:keys [tag-value]})
Compile-time parser of var tag filters.
Compile-time parser of var tag filters.
(parse parse-fn
input
&
[{:keys [tag-open tag-close filter-open filter-close tag-second
short-comment-second]
:or {tag-open *tag-open*
tag-close *tag-close*
filter-open *filter-open*
filter-close *filter-close*
tag-second *tag-second*
short-comment-second *short-comment-second*}
:as params}])
(render s context-map & [opts])
render takes the string, the context-map and possibly also opts.
render takes the string, the context-map and possibly also opts.
(render-file filename-or-url
context-map
&
[{:keys [cache custom-resource-path url-stream-handler]
:or {cache (clojure.core/deref cache?)
custom-resource-path *custom-resource-path*
url-stream-handler *url-stream-handler*}
:as opts}])
Parses files if there isn't a memoized post-parse vector ready to go, renders post-parse vector with passed context-map regardless. Double-checks last-modified on files. Uses classpath for filename-or-url path
Parses files if there isn't a memoized post-parse vector ready to go, renders post-parse vector with passed context-map regardless. Double-checks last-modified on files. Uses classpath for filename-or-url path
(render-template template context-map)
vector of ^selmer.node.INodes and a context map.
vector of ^selmer.node.INodes and a context map.
(resolve-arg arg context-map)
Resolves an arg as passed to an add-tag! handler using the provided context-map.
A custom tag handler will receive a seq of args as its first argument. With this function, you can selectively resolve one or more of those args so that if they contain literals, the literal value is returned, and if they contain templates of any sort, which can itself have variables, filters or tags in it, they will be returned resolved, applied and rendered.
Example: (resolve-arg {{header-name|upper}} {:header-name "My Page"}) => "MY PAGE"
Resolves an arg as passed to an add-tag! handler using the provided context-map. A custom tag handler will receive a seq of args as its first argument. With this function, you can selectively resolve one or more of those args so that if they contain literals, the literal value is returned, and if they contain templates of any sort, which can itself have variables, filters or tags in it, they will be returned resolved, applied and rendered. Example: (resolve-arg {{header-name|upper}} {:header-name "My Page"}) => "MY PAGE"
(set-resource-path! path)
set custom location, where templates are being searched for. path may be a java.net.URL instance or a string. If it's a string, we first try to convert it to a java.net.URL instance and if it doesn't work it's interpreted as a path in the local filesystem.
set custom location, where templates are being searched for. path may be a java.net.URL instance or a string. If it's a string, we first try to convert it to a java.net.URL instance and if it doesn't work it's interpreted as a path in the local filesystem.
(tag-content rdr start-tag & end-tags)
Parses the content of a tag. Returns a map of tag-name -> args & content, which can then be interpreted by the calling function.
Parses the content of a tag. Returns a map of tag-name -> args & content, which can then be interpreted by the calling function.
(update-tags tag tags content args buf)
Assocs in the passed tag to the tags map.
Assocs in the passed tag to the tags map.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close