mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
Merge branch '1.x' into 2.x
* 1.x: Update doc with new escaping behavior Remove obsolete page language typo
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
},
|
||||
{
|
||||
"name": "Twig Team",
|
||||
"homepage": "https://twig.symfony.com/contributors",
|
||||
"role": "Contributors"
|
||||
},
|
||||
{
|
||||
|
||||
+3
-5
@@ -399,7 +399,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
|
||||
@@ -407,14 +407,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 #}
|
||||
|
||||
* Objects with a ``__toString`` method are converted to strings and
|
||||
escaped. You can mark some classes and/or interfaces as being safe for some
|
||||
strategies via ``EscaperExtension::addSafeClass()``:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
===========
|
||||
|
||||
``same as`` checks if a variable is the same as another variable.
|
||||
This is the equivalent to ``===`` in PHP:
|
||||
This is equivalent to ``===`` in PHP:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
|
||||
Reference in New Issue
Block a user