Update doc with new escaping behavior

When applied on ternary statements
This commit is contained in:
Laurent VOULLEMIER
2019-12-22 09:16:04 +01:00
committed by Fabien Potencier
parent 1a874b581a
commit 92e1cd35c5
+3 -5
View File
@@ -416,7 +416,7 @@ The escaping rules are implemented as follows:
{% set text = "Twig<br />" %}
{{ text }} {# will be escaped #}
* Expressions which the result is always a literal or a variable marked safe
* Expressions which the result is a literal or a variable marked safe
are never automatically escaped:
.. code-block:: twig
@@ -424,14 +424,12 @@ The escaping rules are implemented as follows:
{{ foo ? "Twig<br />" : "<br />Twig" }} {# won't be escaped #}
{% set text = "Twig<br />" %}
{{ foo ? text : "<br />Twig" }} {# will be escaped #}
{{ true ? text : "<br />Twig" }} {# will be escaped #}
{{ false ? text : "<br />Twig" }} {# won't be escaped #}
{% set text = "Twig<br />" %}
{{ foo ? text|raw : "<br />Twig" }} {# won't be escaped #}
{% set text = "Twig<br />" %}
{{ foo ? text|escape : "<br />Twig" }} {# the result of the expression won't be escaped #}
* Escaping is applied before printing, after any other filter is applied:
.. code-block:: twig