add more tests
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
==================
|
||||
Filter Basic
|
||||
==================
|
||||
|
||||
<p>
|
||||
{% filter upper %}
|
||||
hello
|
||||
{% endfilter %}
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(filter_group
|
||||
(filter_expression
|
||||
(filter))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Filter With Chain
|
||||
==================
|
||||
|
||||
<p>
|
||||
{% filter lower|title %}
|
||||
HELLO WORLD
|
||||
{% endfilter %}
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(filter_group
|
||||
(filter_expression
|
||||
(filter)
|
||||
(filter))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
@@ -0,0 +1,46 @@
|
||||
==================
|
||||
Firstof Basic
|
||||
==================
|
||||
|
||||
{% firstof var1 var2 "default" %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(firstof
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(string)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Firstof With As
|
||||
==================
|
||||
|
||||
{% firstof var1 var2 as result %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(firstof
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(identifier))
|
||||
(content))
|
||||
@@ -0,0 +1,94 @@
|
||||
==================
|
||||
For Basic
|
||||
==================
|
||||
|
||||
<ul>
|
||||
{% for item in items %}
|
||||
<li>{{ item }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(for_group
|
||||
variables: (identifier)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
For With Multiple Variables
|
||||
==================
|
||||
|
||||
<dl>
|
||||
{% for key, value in items %}
|
||||
<dt>{{ key }}</dt>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(for_group
|
||||
variables: (identifier)
|
||||
variables: (identifier)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
For With Empty
|
||||
==================
|
||||
|
||||
<ul>
|
||||
{% for item in items %}
|
||||
<li>{{ item }}</li>
|
||||
{% empty %}
|
||||
<li>Empty</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(for_group
|
||||
variables: (identifier)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
@@ -0,0 +1,89 @@
|
||||
==================
|
||||
If Basic
|
||||
==================
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
Hi
|
||||
{% endif %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(if_group
|
||||
(predicate
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)
|
||||
(attribute)))))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
If With Not
|
||||
==================
|
||||
|
||||
{% if not done %}
|
||||
working
|
||||
{% endif %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(if_group
|
||||
(predicate
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
If With Elif And Else
|
||||
==================
|
||||
|
||||
{% if count == 1 %}
|
||||
one
|
||||
{% elif count == 2 %}
|
||||
two
|
||||
{% else %}
|
||||
other
|
||||
{% endif %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(if_group
|
||||
(predicate
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(template
|
||||
(content))
|
||||
(predicate
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(template
|
||||
(content))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
@@ -0,0 +1,41 @@
|
||||
==================
|
||||
Ifchanged Basic
|
||||
==================
|
||||
|
||||
{% ifchanged %}
|
||||
content
|
||||
{% endifchanged %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(ifchanged_group
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Ifchanged With Values
|
||||
==================
|
||||
|
||||
{% ifchanged var1 var2 %}
|
||||
content
|
||||
{% endifchanged %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(ifchanged_group
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
@@ -0,0 +1,33 @@
|
||||
==================
|
||||
Include With String
|
||||
==================
|
||||
|
||||
{% include "sidebar.html" %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(include
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(string)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Include With Variable
|
||||
==================
|
||||
|
||||
{% include template_name %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(include
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content))
|
||||
@@ -0,0 +1,33 @@
|
||||
==================
|
||||
Lorem Words
|
||||
==================
|
||||
|
||||
{% lorem 3 w %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(lorem
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Lorem Paragraphs Random
|
||||
==================
|
||||
|
||||
{% lorem 2 p random %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(lorem
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(content))
|
||||
@@ -0,0 +1,83 @@
|
||||
==================
|
||||
Verbatim Basic
|
||||
==================
|
||||
|
||||
{% verbatim %}{{ hello }}{% endverbatim %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(verbatim_group
|
||||
name: (push_verbatim)
|
||||
(verbatim_content)
|
||||
(pop_verbatim))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Verbatim Empty
|
||||
==================
|
||||
|
||||
{% verbatim %}{% endverbatim %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(verbatim_group
|
||||
name: (push_verbatim)
|
||||
(pop_verbatim))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Verbatim Ignores Tags
|
||||
==================
|
||||
|
||||
{% verbatim %}
|
||||
{{ hello }}
|
||||
{% for x in y %}
|
||||
{% endverbatim %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(verbatim_group
|
||||
name: (push_verbatim)
|
||||
(verbatim_content)
|
||||
(pop_verbatim))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Verbatim With Name
|
||||
==================
|
||||
|
||||
{% verbatim myblock %}{{ hello }}{% endverbatim myblock %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(verbatim_group
|
||||
name: (push_verbatim)
|
||||
(verbatim_content)
|
||||
(pop_verbatim))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Verbatim With Name Allows Nested Unnamed Verbatim
|
||||
==================
|
||||
|
||||
{% verbatim myblock %}
|
||||
Avoid template rendering via the {% verbatim %}{% endverbatim %} block.
|
||||
{% endverbatim myblock %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(verbatim_group
|
||||
name: (push_verbatim)
|
||||
(verbatim_content)
|
||||
(pop_verbatim))
|
||||
(content))
|
||||
Reference in New Issue
Block a user