Tests
Test: array-as-variable
Template
{{ items|last }}
Data
{
"items": [1, 2, 3, 4]
}
Output Django v1.10.1
4
Output Jinja2 v2.8.0
4
Output Liquid v3.0.6
4
Output Nunjucks v2.5.0
4
Output Swig v1.4.2
4
Output Twig v1.24.2
4
Output Twigjs v0.9.5
4
Test: array
Template
{{ [1, 2, 3, 4]|last }}
Output Django (error) v1.10.1
Could not parse some characters: |[1, 2, 3, 4]||last
Output Jinja2 v2.8.0
4
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
4
Output Swig v1.4.2
4
Output Twig v1.24.2
4
Output Twigjs v0.9.5
4
Test: number
Template
{{ 1234|last }}
Output Django (error) v1.10.1
'int' object has no attribute '__getitem__'
Output Jinja2 (error) v2.8.0
argument to reversed() must be a sequence
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks (error) v2.5.0
(no output)
Output Swig v1.4.2
undefined
Output Twig v1.24.2
4
Output Twigjs (error) v0.9.5
(no output)
Test: object
Template
{{ { a: 1, b: 2, c: 3, d: 4 }|last }}
Output Django (error) v1.10.1
Could not parse some characters: |{ a: 1, b: 2, c: 3, d: 4 }||last
Output Jinja2 (error) v2.8.0
argument to reversed() must be a sequence
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 (error) v2.5.0
(no output)
Output Swig v1.4.2
4
Output Twig v1.24.2
4
Output Twigjs v0.9.5
4
Test: string
Template
{{ '1234'|last }}
Output Django v1.10.1
4
Output Jinja2 v2.8.0
4
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
4
Output Swig v1.4.2
4
Output Twig v1.24.2
4
Output Twigjs v0.9.5
4