Variable replacement
Variable replacement rules in module fields.
Variables in module input fields are replaced following the standard Jinja templating rules, here are some examples:
| Comment on source value | Source value (exact value of x) | Body to be replaced | Final result | Comment on final result |
|---|---|---|---|---|
| null value | null | {{ x }} | null | null value |
| string | hello | {{ x }} | hello | string |
| json | {"y":"world"} | {{ x }} | {"y":"world"} | json |
| string | {"y":"world"} | {{ x }} | {"y":"world"} | string |
| number | 123 | {{ x }} | 123 | number |
| string | 123 | {{ x }} | 123 | string |
| empty string | {{ x }} | empty string | ||
| string | {{ text }} | {{ x }} | {{ text }} | string |
| null value | null | {{ x.y }} | null | null value |
| string | hello | {{ x.y }} | null | null value |
| json | {"y":"world"} | {{ x.y }} | world | string |
| empty string | {{ x.y }} | null | empty string | |
| json | {"y":"world"} | {{ x.y }} | world | string |
| string | {"y":"world"} | {{ x.y }} | null | null value |
| number | 123 | {{ x.y }} | null | number |
| string | 123 | {{ x.y }} | null | string |
| json | {"y":123} | {{ x.y }} | 123 | number |
| json | {"y":"123"} | {{ x.y }} | 123 | string |
| string | {{ text }} | {{ x.y }} | {{ text }} | string |
Not replacing sections enclosed in double curly brackets
Use cases require to have a text between curly brackets NOT replaced by the templating engine.
An example body not to be replaced is {{ customer text that should remain in curly brackets }}
In this case, the text not to be replaced can be formatted as follows to maintain the curly brackets
{{ {{ customer text that should remain in curly brackets }} }}where the final result would be in the final body (after replacement) is
{{ customer text that should remain in curly brackets }}