Squiggly

Builtins

The bundled template functions — strings, lists, regex, dates, debug.

Squiggly ships with a standard library of 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 two equivalent forms:

{{ trim .name }}              // function-call form
{{ .name | trim }}            // pipe form
{{ .name.trim }}              // method form (1-arg only)

Pages below catalog them by category.

Pages

  • Strings — upper, lower, trim, replace, split, join, and friends.
  • Collections — Operating on lists and maps — head, tail, append, distinct, sort.
  • Regex — matchRE, findRE, replaceRE for pattern-based string operations.
  • Dates — now, dateFormat, dateParse — built on java.time.
  • URL & text helpers — relURL, absURL, markdownify, emojify — for sites that emit HTML.
  • Debug — context, type — what's actually in scope here?