Skip to main content

$$template

Renders a specified text template with the given input referencing a specified payload.

Usage​

{ 
"$$template": /* The text template to render */,
"payload": /* any */,
"default_resolve": "UNIQUE" /* or FIRST_VALUE / LAST_VALUE */,
"url_encode": false /* boolean */
}
"$$template([payload],[default_resolve],[url_encode]):{input}"
note

Concrete values in the usage example are default values.

Returns​

string

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
PrimarystringYesThe text template to render
payloadanynullAdditional context, referred to as ##current from the template
default_resolveenumUNIQUE/ FIRST_VALUE/LAST_VALUEUNIQUEResolve default value based on previous default values or not
url_encodebooleanfalse/truefalseURL encode parameters

* Different Types of default parameter resolving options​

TypeDescription
UNIQUE (default)Each instance of a parameter is resolved to its explicit default
FIRST_VALUEThe first default found for the parameter is used by all
LAST_VALUEThe last default found is used by all

Examples​

Input

Definition

Output

{
"name": "World"
}
"$$template:Hello {$.name}"
"Hello World"
{
"name": "World"
}
"$$template($):Hello {##current.name}"
"Hello World"
{
"text": "HELLO"
}
"$$template:{$$lower:$.text}"
"hello"
{
"name": "World"
}
{
"$$template": "Hello {$.name}"
}
"Hello World"
{
"name": "World"
}
{
"$$template": "Hello {##current.name}",
"payload": "$"
}
"Hello World"
{
"text": "HELLO"
}
{
"$$template": "{$$lower:$.text}"
}
"hello"
{
"id": "1"
}
"$$template:{$.id} \\{type: {$.type,Unknown}}"
"1 {type: Unknown}"
{
"href": "https://example.com/"
}
{
"$$template": "href={$.href}",
"payload": "$",
"url_encode": true
}
"href=https%3A%2F%2Fexample.com%2F"
{
"href": "https://example.com/"
}
{
"$$template": "href={$.url,{$.href}}",
"payload": "$",
"url_encode": true
}
"href=https%3A%2F%2Fexample.com%2F"