Skip to content

Commit 92e1cd3

Browse files
l-vofabpot
authored andcommitted
Update doc with new escaping behavior
When applied on ternary statements
1 parent 1a874b5 commit 92e1cd3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

doc/api.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,22 +416,20 @@ The escaping rules are implemented as follows:
416416
{% set text = "Twig<br />" %}
417417
{{ text }} {# will be escaped #}
418418
419-
* Expressions which the result is always a literal or a variable marked safe
419+
* Expressions which the result is a literal or a variable marked safe
420420
are never automatically escaped:
421421

422422
.. code-block:: twig
423423
424424
{{ foo ? "Twig<br />" : "<br />Twig" }} {# won't be escaped #}
425425
426426
{% set text = "Twig<br />" %}
427-
{{ foo ? text : "<br />Twig" }} {# will be escaped #}
427+
{{ true ? text : "<br />Twig" }} {# will be escaped #}
428+
{{ false ? text : "<br />Twig" }} {# won't be escaped #}
428429
429430
{% set text = "Twig<br />" %}
430431
{{ foo ? text|raw : "<br />Twig" }} {# won't be escaped #}
431432
432-
{% set text = "Twig<br />" %}
433-
{{ foo ? text|escape : "<br />Twig" }} {# the result of the expression won't be escaped #}
434-
435433
* Escaping is applied before printing, after any other filter is applied:
436434

437435
.. code-block:: twig

0 commit comments

Comments
 (0)