- Issue created by @pdureau
- Status changed to Postponed
4 months ago 12:15pm 15 August 2024
Twig, Jinja, Nunjucks... allow to replace this annoying syntax;
{% if foo %}
{% for item in foo %}
{{ item }}
{% endfor %}
{% else %}
No foo
{% endif %}
by this compact, elegant, syntax:
{% for item in foo %}
{{ item }}
{% else %}
No foo
{% endfor %}
More generally, without considering the ELSE part, it seems this:
{% if foo %}
{% for item in foo %}
{{ item }}
{% endfor %}
{% endif %}
{% if foo is whatever condition %}
{% for item in foo %}
{{ item }}
{% endfor %}
{% endif %}
can also be written like this:
{% for item in foo %}
{{ item }}
{% endfor %}
It would be nice to promote it as a good practice.
Is it easy to test in ui_patterns_devel's component validator if a IF block has empty text nodes and a FOR block as only child nodes?
Active
2.0
UI Patterns Devel [2.x only]