2 "autoescape" tag applies escaping after calling filters, and before calling pre_escape filters
4 {% autoescape 'html' %}
6 (nl2br is pre_escaped for "html" and declared safe for "html")
8 1. Pre-escape and don't post-escape
12 2. Don't double-pre-escape
14 {{ var|escape|nl2br }}
16 3. Don't escape safe values
20 4. Don't escape safe values
21 ( var|escape|nl2br|nl2br )
24 5. Re-escape values that are escaped for an other contexts
25 ( var|escape_something|escape|nl2br )
26 {{ var|escape_something|nl2br }}
28 6. Still escape when using filters not declared safe
29 ( var|escape|nl2br|upper|escape )
34 return array('var' => "<Fabien>\nTwig")
37 (nl2br is pre_escaped for "html" and declared safe for "html")
39 1. Pre-escape and don't post-escape
44 2. Don't double-pre-escape
49 3. Don't escape safe values
54 4. Don't escape safe values
55 ( var|escape|nl2br|nl2br )
56 <Fabien><br /><br />
59 5. Re-escape values that are escaped for an other contexts
60 ( var|escape_something|escape|nl2br )
64 6. Still escape when using filters not declared safe
65 ( var|escape|nl2br|upper|escape )
66 &LT;FABIEN&GT;<BR />