Tests
Test: array
Template
{{ [1, 2, 3, 4]|length }}
Output Django (error) v1.10.1
Could not parse some characters: |[1, 2, 3, 4]||length
Output Jinja2 v2.8.0
4
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
4
Output Swig (error) v1.4.2
Invalid filter "length".
Output Twig v1.24.2
4
Output Twigjs v0.9.5
4
Test: number
Template
{{ 1234|length }}
Output Django v1.10.1
0
Output Jinja2 (error) v2.8.0
object of type 'int' has no len()
Output Liquid v3.0.6
1234
Output Nunjucks (error) v2.5.0
(no output)
Output Swig (error) v1.4.2
Invalid filter "length".
Output Twig v1.24.2
4
Output Twigjs v0.9.5
0
Test: object
Template
{{ { a: 1, b: 2, c: 3, d: 4 }|length }}
Output Django (error) v1.10.1
Could not parse some characters: |{ a: 1, b: 2, c: 3, d: 4 }||length
Output Jinja2 v2.8.0
1
Output Liquid (error) v3.0.6
Liquid syntax error: Variable '{{ { a: 1, b: 2, c: 3, d: 4 }' was not properly terminated with regexp: /\}\}/
Output Nunjucks v2.5.0
4
Output Swig (error) v1.4.2
Invalid filter "length".
Output Twig v1.24.2
4
Output Twigjs v0.9.5
4
Test: string
Template
{{ '1234'|length }}
Output Django v1.10.1
4
Output Jinja2 v2.8.0
4
Output Liquid v3.0.6
1234
Output Nunjucks v2.5.0
4
Output Swig (error) v1.4.2
Invalid filter "length".
Output Twig v1.24.2
4
Output Twigjs v0.9.5
4