tera icon indicating copy to clipboard operation
tera copied to clipboard

Filter sections but set the result in a variable

Open piegamesde opened this issue 1 year ago • 1 comments

Not sure how to best describe this, and I couldn't find anything matching in the documentation. But basically what I need is to create a larger string, and use the templating features for that. The documentation mentions "filter sections":

{% filter upper %}
    Hello
{% endfilter %}

and what I'd need would be something like

{% set upper %}
    Hello
{% endset %}

which stores Hello in the variable upper. The important bit is that I can then use all of the templating features inside it.

Not sure if there are other ways to achieve it

piegamesde avatar Mar 22 '24 19:03 piegamesde

Well it's actually implemented exactly like that in v2: https://github.com/Keats/tera2/blob/master/src/tests/rendering_inputs/success/set_blocks.txt ;)

Keats avatar Mar 23 '24 09:03 Keats