| 1 | <h2>Comments</h2> |
| 2 | <pre><code>{# Some comment |
| 3 | on multiple lines |
| 4 | with <html></html> |
| 5 | inside #}</code></pre> |
| 6 | |
| 7 | <h2>Keywords</h2> |
| 8 | <pre><code>{% if foo %} bar {% endif %} |
| 9 | {% for key, value in arr if value %} {{ do_something() }} {% endfor %} |
| 10 | {% include 'header.html' %} |
| 11 | {% include 'template.html' with {'foo': 'bar'} %}</code></pre> |
| 12 | |
| 13 | <h2>Operators</h2> |
| 14 | <pre><code>{{ not a }} |
| 15 | {{ 20 // 7 }} |
| 16 | {{ b b-and c }} |
| 17 | {% if phone matches '/^[\\d\\.]+$/' %} ... {% endif %}</code></pre> |
| 18 | |
| 19 | <h2>Twig embedded in HTML</h2> |
| 20 | <pre><code><div> |
| 21 | {% if foo %} |
| 22 | <p>Foo!</p> |
| 23 | {% else %} |
| 24 | <p>Not foo...</p> |
| 25 | {% endif %}</code></pre> |