Files
tree-sitter-django/test/corpus/template_variable.txt
T

364 lines
5.1 KiB
Plaintext

==================
Template Variable Integer
==================
{{ 42 }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(number)))))
(content))
==================
Template Variable Negative Float
==================
{{ -3.14 }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(number)))))
(content))
==================
Template Variable Scientific Notation
==================
{{ 1.5e10 }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(number)))))
(content))
==================
Template Variable Double Quoted String
==================
{{ "hello world" }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(string)))))
(content))
==================
Template Variable Single Quoted String With Escape
==================
{{ 'it\'s ok' }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(string)))))
(content))
==================
Template Variable Identifier
==================
{{ name }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))))
(content))
==================
Template Variable Attribute Access
==================
{{ user.profile.email }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)
(attribute)))))
(content))
==================
Template Variable With Single Filter
==================
{{ name|upper }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter))))
(content))
==================
Template Variable With Filter Chain
==================
{{ name|lower|title }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter)
(filter))))
(content))
==================
Template Variable With Filter Argument
==================
{{ price|add:"5" }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter
argument: (value
(literal
(string)))))))
(content))
==================
Template Variable Number With Filter Argument
==================
{{ 3.14|floatformat:2 }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(number)))
(filter_expression
(filter
argument: (value
(literal
(number)))))))
(content))
==================
Template Variable Literal Adjacent To Name
:error
==================
{{ 1x }}
---
==================
Template Variable With Escaped String
==================
{{ "a\nb\"c" }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(string)))))
(content))
==================
Template Variable Signed Number
==================
{{ +1.5 }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(number)))))
(content))
==================
Template Variable Underscore Separated Number
==================
{{ 1_000 }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(number)))))
(content))
==================
Template Variable Attribute Beginning With Underscore
:error
==================
{{ user._private }}
---
==================
Template Variable Translated String
==================
{{ _("Hello") }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(translated_string
(string))))))
(content))
==================
Template Variable Translated String With Filter
==================
{{ _('Hello')|upper }}
---
(template
(content)
(template_variable
(filtered_value
(value
(literal
(translated_string
(string))))
(filter_expression
(filter))))
(content))
==================
Template Variable Translated String With Spaces
:error
==================
{{ _( "Hello" ) }}
---
==================
Template Variable Spanning Lines
==================
{{ value
|floatformat:2 }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter
argument: (value
(literal
(number)))))))
(content))
==================
Template Variable With Spaced Filter
==================
{{ value | upper }}
---
(template
(content)
(template_variable
(filtered_value
(value
(variable_attribute
(identifier)))
(filter_expression
(filter))))
(content))