forked from mitsuhiko/minijinja
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set.txt
47 lines (40 loc) · 696 Bytes
/
set.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
"foo": "root value"
}
---
Basic:
{{ foo }}
{% set foo = "new value" %}
{{ foo }}
{% with %}
{% set foo = "new value 2" %}
{{ foo }}
{% endwith %}
{{ foo }}
Into Loop:
{% for item in [1, 2, 3] %}
{{ item }}
{% set item = item * 2 %}
{{ item }}
{% endfor %}
Conditional:
{% if true %}{% set foo = "was true" %}{% endif %}
{{ foo }}
Multiline:
{% set multiline = "
hello
world" %}
{{ multiline }}
Multiline:
{% set multiline = "hello
world" %}
{{ multiline }}
Block:
{% set var %}This is a {{ foo }}{% endset %}
[{{ var }}]
Filter block
{% set upper_var | upper %}This is a {{ foo }}{% endset %}
[{{ upper_var }}]
Set with +
{% set set_plus = "hello" + "world" %}
{{ set_plus }}