Tests
Test: alias-d
Template
{{ varX|d('"varX" is not defined') }}
Output Django (error) v1.10.1
Invalid filter: 'd'
Output Jinja2 v2.8.0
"varX" is not defined
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
"varX" is not defined
Output Swig (error) v1.4.2
Invalid filter "d".
Output Twig (error) v1.24.2
Unknown "d" filter. Did you mean "date", "round", "default", "url_encode", "json_encode", "date_modify", "convert_encoding"?
Output Twigjs (error) v0.9.5
Unable to find filter d
Test: empty-string-strict
Template
{{ ''|default('passed string is empty', true) }}
Output Django (error) v1.10.1
default requires 2 arguments, 1 provided
Output Jinja2 v2.8.0
passed string is empty
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
passed string is empty
Output Swig v1.4.2
passed string is empty
Output Twig v1.24.2
passed string is empty
Output Twigjs (error) v0.9.5
TwigException: default filter expects one argument
Test: empty-string
Template
{{ ''|default('passed string is empty') }}.
Output Django (error) v1.10.1
default requires 2 arguments, 1 provided
Output Jinja2 v2.8.0
.
Output Liquid v3.0.6
.
Output Nunjucks v2.5.0
.
Output Swig v1.4.2
passed string is empty.
Output Twig v1.24.2
passed string is empty.
Output Twigjs v0.9.5
passed string is empty.
Test: undefined-property-bracket-notation
Template
{{ vars['x']|default('"x" on "vars" is not defined') }}
Output Django (error) v1.10.1
Could not parse some characters: vars|['x']||default('"x" on "vars" is not defined')
Output Jinja2 (error) v2.8.0
'vars' is undefined
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
"x" on "vars" is not defined
Output Swig v1.4.2
"x" on "vars" is not defined
Output Twig v1.24.2
"x" on "vars" is not defined
Output Twigjs v0.9.5
"x" on "vars" is not defined
Test: undefined-property-dot-notation
Template
{{ vars.x|default('"x" on "vars" is not defined') }}
Output Django (error) v1.10.1
default requires 2 arguments, 1 provided
Output Jinja2 (error) v2.8.0
'vars' is undefined
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
"x" on "vars" is not defined
Output Swig v1.4.2
"x" on "vars" is not defined
Output Twig v1.24.2
"x" on "vars" is not defined
Output Twigjs v0.9.5
"x" on "vars" is not defined
Test: undefined-variable
Template
{{ varX|default('"varX" is not defined') }}
Output Django (error) v1.10.1
default requires 2 arguments, 1 provided
Output Jinja2 v2.8.0
"varX" is not defined
Output Liquid (error) v3.0.6
(no output)
Output Nunjucks v2.5.0
"varX" is not defined
Output Swig v1.4.2
"varX" is not defined
Output Twig v1.24.2
"varX" is not defined
Output Twigjs v0.9.5
"varX" is not defined