Twig is an open source template language created in 2009.
| #313on PLDB | 17Years Old | 6kRepos |
git clone https://github.com/mitsuhiko/twigTwig is a template engine for the PHP programming language. Its syntax originates from Jinja and Django templates. It's an open source product licensed under a BSD License and maintained by Fabien Potencier. Read more on Wikipedia...
{% extends "base.html" %}
{% block navigation %}
<ul id="navigation">
{% for item in navigation %}
<li>
<a href="{{ item.href }}">
{% if item.level == 2 %} {% endif %}
{{ item.caption|upper }}
</a>
</li>
{% endfor %}
</ul>
{% endblock navigation %}{% extends "base.html" %}
{% block navigation %}
<ul id="navigation">
{% for item in navigation %}
<li>
<a href="{{ item.href }}">
{% if item.level == 2 %} {% endif %}
{{ item.caption|upper }}
</a>
</li>
{% endfor %}
</ul>
{% endblock navigation %}apply autoescape block deprecated do embed extends flush for from if import include macro sandbox set use verbatim with endapply endautoescape endblock endembed endfor endif endmacro endsandbox endset endwith true false| Feature | Supported | Example | Token |
|---|---|---|---|
| Conditionals | ✓ | ||
| Inheritance | ✓ | ||
| Booleans | ✓ | true false | |
| Comments | ✓ | {# A comment #} | |
| MultiLine Comments | ✓ | {# A comment #} | {# #} |