twig.twig 761 B

123456789101112131415161718192021222324252627282930
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>My Webpage</title>
  5. </head>
  6. <body>
  7. <ul id="navigation">
  8. {% for item in navigation %}
  9. <li><a href="{{ item.href|escape }}">{{ item.caption }}</a></li>
  10. {% endfor %}
  11. </ul>
  12. {% if 1 not in [1, 2, 3] %}
  13. {# is equivalent to #}
  14. {% if not (1 in [1, 2, 3]) %}
  15. {% autoescape true %}
  16. {{ var }}
  17. {{ var|raw }} {# var won't be escaped #}
  18. {{ var|escape }} {# var won't be doubled-escaped #}
  19. {% endautoescape %}
  20. {{ include('twig.html', sandboxed = true) }}
  21. {{"string #{with} \" escapes" 'another#one' }}
  22. <h1>My Webpage</h1>
  23. {{ a_variable }}
  24. </body>
  25. </html>