Builtins
The bundled template functions — strings, numbers, collections, regex, dates, url/text, debug.
Squiggly ships with a standard library of ~80 template functions in
TemplateBuiltin.functions. Pass it (and any additions of your own)
to the renderer:
val renderer = new TemplateRenderer(
functions = TemplateBuiltin.functions ++ myCustomFunctions,
)
Every builtin is callable in three equivalent forms:
{{ trim .name }} // function-call form
{{ .name | trim }} // pipe form (data threads in as last arg)
{{ .name.trim }} // method form (1-arg only)
Pages below catalog them by category:
- Strings — case, whitespace, search, slicing, editing,
printf - Numbers — math, parse/coerce (
int/float/bool), formatted output - Collections — lists, maps, slicing,
map/filter, set ops - Regex —
findREwith capture groups - Dates —
now/time/unix/formatonjava.time - URL & text helpers —
urlize/slugify/markdownify/emojify/jsonStr/querify - Debug —
context/print/println