mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-21 15:48:42 +00:00
updated documentation and added a unit test
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|
||||||
|
* changed the way {% set %} works when capturing (the content is now marked as safe)
|
||||||
* added support for macro name in the endmacro tag
|
* added support for macro name in the endmacro tag
|
||||||
* fixed the "length" filter for numbers
|
* fixed the "length" filter for numbers
|
||||||
* removed coupling between Twig_Node and Twig_Template
|
* removed coupling between Twig_Node and Twig_Template
|
||||||
|
|||||||
+7
-2
@@ -724,7 +724,7 @@ You can also chain filters:
|
|||||||
<strong>SOME TEXT</strong>
|
<strong>SOME TEXT</strong>
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
|
|
||||||
It should returns ``<strong>some text</strong>``.
|
It should return ``<strong>some text</strong>``.
|
||||||
|
|
||||||
Assignments
|
Assignments
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
@@ -744,7 +744,7 @@ the ``set`` tag and can have multiple targets:
|
|||||||
|
|
||||||
{% set foo, bar = 'foo', 'bar' %}
|
{% set foo, bar = 'foo', 'bar' %}
|
||||||
|
|
||||||
The ``set`` tag can also be used to 'capture' chunks of HTML:
|
The ``set`` tag can also be used to 'capture' chunks of text:
|
||||||
|
|
||||||
.. code-block:: jinja
|
.. code-block:: jinja
|
||||||
|
|
||||||
@@ -754,6 +754,11 @@ The ``set`` tag can also be used to 'capture' chunks of HTML:
|
|||||||
</div>
|
</div>
|
||||||
{% endset %}
|
{% endset %}
|
||||||
|
|
||||||
|
.. caution::
|
||||||
|
|
||||||
|
If you enable automatic output escaping, Twig will only consider the
|
||||||
|
content to be safe when capturing chunks of text.
|
||||||
|
|
||||||
Extends
|
Extends
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
"set" tag
|
"set" tag
|
||||||
--TEMPLATE--
|
--TEMPLATE--
|
||||||
{% set foo = 'foo' %}
|
{% set foo = 'foo' %}
|
||||||
|
{% set bar = 'foo<br />' %}
|
||||||
|
|
||||||
{{ foo }}
|
{{ foo }}
|
||||||
|
{{ bar }}
|
||||||
|
|
||||||
{% set foo, bar = 'foo', 'bar' %}
|
{% set foo, bar = 'foo', 'bar' %}
|
||||||
|
|
||||||
@@ -12,6 +14,7 @@
|
|||||||
return array()
|
return array()
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
foo
|
foo
|
||||||
|
foo<br />
|
||||||
|
|
||||||
|
|
||||||
foobar
|
foobar
|
||||||
|
|||||||
Reference in New Issue
Block a user