$$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​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | string | Yes | The text template to render | |
payload | any | null | Additional context, referred to as ##current from the template | |
default_resolve | enum | UNIQUE / FIRST_VALUE /LAST_VALUE | UNIQUE | Resolve default value based on previous default values or not |
url_encode | boolean | false /true | false | URL encode parameters |
* Different Types of default parameter resolving options​
Type | Description |
---|---|
UNIQUE (default) | Each instance of a parameter is resolved to its explicit default |
FIRST_VALUE | The first default found for the parameter is used by all |
LAST_VALUE | The 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"