626 lines
11 KiB
Plaintext
626 lines
11 KiB
Plaintext
==================
|
|
For Basic
|
|
==================
|
|
|
|
<ul>
|
|
{% for item in items %}
|
|
<li>{{ item }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(template_variable
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With Multiple Variables
|
|
==================
|
|
|
|
<dl>
|
|
{% for key, value in items %}
|
|
<dt>{{ key }}</dt>
|
|
{% endfor %}
|
|
</dl>
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(template_variable
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With Empty
|
|
==================
|
|
|
|
<ul>
|
|
{% for item in items %}
|
|
<li>{{ item }}</li>
|
|
{% empty %}
|
|
<li>Empty</li>
|
|
{% endfor %}
|
|
</ul>
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(template_variable
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(content)))
|
|
(empty_block
|
|
(empty_tag)
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With A Tag In Its Body
|
|
==================
|
|
|
|
{% for x in y %}
|
|
{% if a %}b{% endif %}
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(if_group
|
|
(if_block
|
|
(if_tag
|
|
(predicate
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))))
|
|
(template
|
|
(content)))
|
|
(endif_tag))
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With A Nested For
|
|
==================
|
|
|
|
{% for x in y %}
|
|
{% for z in x %}a{% endfor %}
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With Tags In Both Branches
|
|
==================
|
|
|
|
{% for x in y %}
|
|
{% if a %}b{% endif %}
|
|
{% empty %}
|
|
{% with c=1 %}d{% endwith %}
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(if_group
|
|
(if_block
|
|
(if_tag
|
|
(predicate
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))))
|
|
(template
|
|
(content)))
|
|
(endif_tag))
|
|
(content)))
|
|
(empty_block
|
|
(empty_tag)
|
|
(template
|
|
(content)
|
|
(with_group
|
|
(with_block
|
|
(with_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(literal
|
|
(number)))))
|
|
(template
|
|
(content)))
|
|
(endwith_tag))
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With A Named Block In Its Body
|
|
==================
|
|
|
|
{% for x in y %}
|
|
{% block b %}c{% endblock b %}
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(block_group
|
|
(block_block
|
|
(block_tag
|
|
name: (push_block))
|
|
(template
|
|
(content)))
|
|
(endblock_tag
|
|
(pop_block)))
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For Nested In A Tag
|
|
==================
|
|
|
|
{% if a %}
|
|
{% for x in y %}{% if b %}c{% endif %}{% endfor %}
|
|
{% endif %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(if_group
|
|
(if_block
|
|
(if_tag
|
|
(predicate
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))))
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(if_group
|
|
(if_block
|
|
(if_tag
|
|
(predicate
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))))
|
|
(template
|
|
(content)))
|
|
(endif_tag))))
|
|
(endfor_tag))
|
|
(content)))
|
|
(endif_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With An Empty Body
|
|
==================
|
|
|
|
{% for x in y %}{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For Reversed
|
|
==================
|
|
|
|
{% for x in y reversed %}
|
|
a
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With Multiple Variables Reversed
|
|
==================
|
|
|
|
{% for k,v in y reversed %}
|
|
a
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With A Filtered Sequence Reversed
|
|
==================
|
|
|
|
{% for x in y|slice:":2" reversed %}
|
|
a
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))
|
|
(filter_expression
|
|
(filter
|
|
argument: (value
|
|
(literal
|
|
(string)))))))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For Reversed With Empty
|
|
==================
|
|
|
|
{% for x in y reversed %}
|
|
a
|
|
{% empty %}
|
|
b
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)))
|
|
(empty_block
|
|
(empty_tag)
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For Reversed With A Tag In Its Body
|
|
==================
|
|
|
|
{% for x in y reversed %}
|
|
{% if a %}b{% endif %}
|
|
{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)
|
|
(if_group
|
|
(if_block
|
|
(if_tag
|
|
(predicate
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))))
|
|
(template
|
|
(content)))
|
|
(endif_tag))
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With Reversed Twice
|
|
==================
|
|
|
|
{% for x in y reversed reversed %}a{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
(identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))
|
|
(unexpected_argument))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With Reversed Before In
|
|
:error
|
|
==================
|
|
|
|
{% for x reversed in y %}a{% endfor %}
|
|
|
|
---
|
|
|
|
|
|
==================
|
|
For Over A Variable Named Reversed
|
|
==================
|
|
|
|
{% for x in reversed reversed %}a{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For Over An Attribute Of A Variable Named Reversed
|
|
==================
|
|
|
|
{% for x in reversed.items %}a{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)
|
|
(attribute)))))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For Over A Filtered Variable Named Reversed
|
|
==================
|
|
|
|
{% for x in reversed|last %}a{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
variable: (identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier)))
|
|
(filter_expression
|
|
(filter))))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|
|
|
|
==================
|
|
For With Reversed As Its Whole Sequence
|
|
:error
|
|
==================
|
|
|
|
{% for x in reversed %}a{% endfor %}
|
|
|
|
---
|
|
|
|
|
|
==================
|
|
For With Reversed Three Times
|
|
==================
|
|
|
|
{% for x in reversed reversed reversed %}a{% endfor %}
|
|
|
|
---
|
|
|
|
(template
|
|
(content)
|
|
(for_group
|
|
(for_block
|
|
(for_tag
|
|
(identifier)
|
|
(filtered_value
|
|
(value
|
|
(variable_attribute
|
|
(identifier))))
|
|
(unexpected_argument))
|
|
(template
|
|
(content)))
|
|
(endfor_tag))
|
|
(content))
|