Tests
Test: array
Template
{{ attribute(items, 2) }}
Data
{
"items": ["alpha", "bravo", "charlie", "delta"]
}
Output Django (error) v1.10.1
Could not parse the remainder: '(items, 2)' from 'attribute(items, 2)'
Output Jinja2 (error) v2.8.0
'attribute' is undefined
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks (error) v2.5.0
Error: Unable to call `attribute`, which is undefined or falsey
Output Swig (error) v1.4.2
(no output)
Output Twig v1.24.2
charlie
Output Twigjs v0.9.5
charlie
Test: object
Template
{{ attribute(mapping, 'x') }}
Data
{
"mapping": {
"x": "alpha",
"y": "bravo",
"z": "charlie"
}
}
Output Django (error) v1.10.1
Could not parse the remainder: '(mapping, 'x')' from 'attribute(mapping, 'x')'
Output Jinja2 (error) v2.8.0
'attribute' is undefined
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks (error) v2.5.0
Error: Unable to call `attribute`, which is undefined or falsey
Output Swig (error) v1.4.2
(no output)
Output Twig v1.24.2
alpha
Output Twigjs v0.9.5
alpha