Jinja2 |
Mako |
{% block title %}{% endblock %}
|
<%block name="title"/>
|
{% extends "base.html" %}
|
<%inherit file="base.html"/>
|
{% include "base.html" %}
|
<%include file="base.html"/>
|
|
<%include file="header.txt" args="title=title,link=pr_comment_url"/>
|
{% if condition %} {% elif condition2 %} {% else %} {% endif %}
|
%if condition: %elif condition2: %else: %endif
|
{% for i in items %} {% endfor %}
|
%for i in items: %endfor
|
{% for i in items %} {{ loop.index }} {% endfor %}
|
%for idx,i in enumerate(items): %endfor
|
{% macro breadcrumbs() %} {% endmacro %}
{{ breadcrumbs() }}
|
<%def name="breadcrumbs()"> </%def>
${self.breadcrumbs()}
|
{% import 'file.html' as mymodule with context %}
|
<%namespace name="mymodule" file="file.html"/>
|
|
# root.html
${next.body()}
# base.html
<%inherit file="root.html"/>
|
{% if item|attr('field') %}
|
%if hasattr(item, 'field'):
|
Фильтры |
{{ "this is some text"|urlencode }}
Фильтр обрабатывает пробел как символ %20
|
${"this is some text" | u}
Фильтр обрабатывает пробел как +
|
x|length
|
len(x)
|
elements|map(attribute='attrname')|join(', ')
|
', '.join((x.attrname for x in elements))
|