• {% autoescape true %} {{ myvar }} {% endautoescape %}
  • {% block body %} … {% endblock %}
  • {% if false %}
  • {% elseif true%}
  • {% else %}
  • {% endif %}
  • {% extends “./layout.html” %}
  • {% filter uppercase %} oh hi, {{ name }} {% endfilter %} # OH HI, PAUL
  • {% filter replace(”.”, ”!”, ‘g”) %} Hi. My name is Paul. {% endfilter %} # Hi! My name is Paul!
  • {% for x in obj %}
    • {% if loop.first %}
        {% endif %}
      • <li>{{ loop.index }} - {{ loop.key }}: {{ x }}</li> - {% if loop.last %}
      {% endif %}
  • {% endfor %}
  • {% for key, val in arr|reverse %}
  • {{ key }} — {{ val }}
  • {% endfor %}
  • {% import ‘./formmacros.html’ as forms %}
  • {{ form.input(“text”, “name”) }} #
  • {% import “../shared/tags.html” as tags%}
  • {{ tags.stylesheet(‘global’)}} //
  • {% include “./partial.html” %}
  • {% include “./partial.html” with my_obj only%}
  • {% include “/this/file/does/not/exist” ignore missing%}
  • {% macro input(type, name, id, label, value, error)%}
    • <label for=”{{ name }}”>{{ label }}</label> - <input type=”{{ type }}” name=”{{ name }}” id=”{{ id }}” value=”{{ value }}” {% if error%} class=“error” {% endif %}>- {% endmacro %}
  • {{ input(“text”, “fname”, “fname”, “First Name”, fname.value, fname.errors) }}
  • {% extends “./foo.html” %}
  • {% block content %}
    • My content
    • {% parent %}
  • {% endblock %}
  • {% raw %}{{ foobar }}{% endraw %}
  • {% set foo = “anything!”%}
  • {{ foo }}
  • {% spaceless %}
    • {% for num in foo %}
    • <li>{{ loop.index }}</li> - {% endfor %}
  • {% endspaceless %} # 除去空白