from yatte import Template as t
tmpl = t('''{% each list %}
{% if _ < 3 %}
sup {{ _ }}
{% end %}
{% end %}''')
print tmpl.render({'list':range(5)})
Output:
sup 0 sup 1 sup 2
Tests:
python tests.py
-
Variable:
{{ var }}
-
Loop the list:
{% each list %} {{ _ }} {% end %}
_
represents a single value from the list. -
Conditional:
{% if var < 5 %} Some text {% end %}
###Thx to: