Files
2026-09-14 18:32:37 -05:00

365 lines
5.2 KiB
Plaintext

==================
Custom Tag
==================
{% mytag %}
---
(template
(content)
(custom_tag
tag_name: (identifier))
(content))
==================
Custom Tag With Arguments
==================
{% mytag a "b" 3 %}
---
(template
(content)
(custom_tag
tag_name: (identifier)
(filtered_value
(value
(variable_attribute
(identifier))))
(filtered_value
(value
(literal
(string))))
(filtered_value
(value
(literal
(number)))))
(content))
==================
Custom Tag With Keyword Arguments
==================
{% mytag a b=1 %}
---
(template
(content)
(custom_tag
tag_name: (identifier)
(filtered_value
(value
(variable_attribute
(identifier))))
(identifier)
(filtered_value
(value
(literal
(number)))))
(content))
==================
Custom Tag With As
==================
{% mytag a as result %}
---
(template
(content)
(custom_tag
tag_name: (identifier)
(filtered_value
(value
(variable_attribute
(identifier))))
variable: (identifier))
(content))
==================
Custom Tag With Filtered Argument
==================
{% mytag a|upper %}
---
(template
(content)
(custom_tag
tag_name: (identifier)
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter))))
(content))
==================
Custom Tag Does Not Nest
==================
{% mytag %}hi{% endmytag %}
---
(template
(content)
(custom_tag
tag_name: (identifier))
(content)
(custom_tag
tag_name: (identifier))
(content))
==================
Custom Tag Does Not Cover A Builtin Name
:error
==================
{% cycle %}
---
==================
Custom Filter
==================
{{ x|intcomma }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter
filter_name: (identifier)))))
(content))
==================
Custom Filter With Argument
==================
{{ x|naturaltime:"y" }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter
filter_name: (identifier)
argument: (value
(literal
(string)))))))
(content))
==================
Custom Filter In A Chain With A Builtin
==================
{{ x|intcomma|upper }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter
filter_name: (identifier))
(filter))))
(content))
==================
Custom Filter In A Tag
==================
{% firstof a|intcomma %}
---
(template
(content)
(firstof_tag
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter
filter_name: (identifier)))))
(content))
==================
Builtin Filter Without Its Required Argument
:error
==================
{{ x|add }}
---
==================
Builtin Filter With An Argument It Does Not Take
:error
==================
{{ x|length:2 }}
---
==================
Custom Tag Does Not Cover An End Tag
==================
{% endif %}
---
(template
(content)
(unexpected_tag)
(content))
==================
Custom Tag Does Not Cover A Part Of A Tag Group
==================
{% else %}
---
(template
(content)
(unexpected_tag)
(content))
==================
A Name Reserved For A Tag Is Still A Variable
==================
{{ endif }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))))
(content))
==================
A Name Reserved For A Tag Is Still An Argument
==================
{% mytag endif %}
---
(template
(content)
(custom_tag
tag_name: (identifier)
(filtered_value
(value
(variable_attribute
(identifier)))))
(content))
==================
Custom Tag With A Keyword Argument Twice
==================
{% mytag a=1 a=2 %}
---
(template
(content)
(custom_tag
(identifier)
(identifier)
(filtered_value
(value
(literal
(number))))
(unexpected_argument))
(content))
==================
Custom Tag With Keyword Arguments And As
==================
{% mytag a=1 b=2 as out %}
---
(template
(content)
(custom_tag
tag_name: (identifier)
(identifier)
(filtered_value
(value
(literal
(number))))
(identifier)
(filtered_value
(value
(literal
(number))))
variable: (identifier))
(content))
==================
Custom Tag Repeating A Keyword Of The Tag Before It
==================
{% mytag page=1 %}{% mytag page=2 %}
---
(template
(content)
(custom_tag
tag_name: (identifier)
(identifier)
(filtered_value
(value
(literal
(number)))))
(custom_tag
tag_name: (identifier)
(identifier)
(filtered_value
(value
(literal
(number)))))
(content))