Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doc with new escaping behavior on ternary statements #3224

Merged
merged 1 commit into from Dec 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions doc/api.rst
Expand Up @@ -416,22 +416,20 @@ 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
{{ 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
Expand Down