Skip to content
Browse files

updated documentation and added a unit test

  • Loading branch information...
1 parent 01b8c7c commit 1ac50758792868825752ccbe7ea47600903d4780 @fabpot committed Feb 18, 2011
Showing with 11 additions and 2 deletions.
  1. +1 −0 CHANGELOG
  2. +7 −2 doc/templates.rst
  3. +3 −0 test/Twig/Tests/Fixtures/tags/set/basic.test
View
1 CHANGELOG
@@ -2,6 +2,7 @@
Changes:
+ * changed the way {% set %} works when capturing (the content is now marked as safe)
* added support for macro name in the endmacro tag
* fixed the "length" filter for numbers
* removed coupling between Twig_Node and Twig_Template
View
9 doc/templates.rst
@@ -724,7 +724,7 @@ You can also chain filters:
<strong>SOME TEXT</strong>
{% endfilter %}
-It should returns ``&lt;strong&gt;some text&lt;/strong&gt;``.
+It should return ``&lt;strong&gt;some text&lt;/strong&gt;``.
Assignments
~~~~~~~~~~~
@@ -744,7 +744,7 @@ the ``set`` tag and can have multiple targets:
{% 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
@@ -754,6 +754,11 @@ The ``set`` tag can also be used to 'capture' chunks of HTML:
</div>
{% endset %}
+.. caution::
+
+ If you enable automatic output escaping, Twig will only consider the
+ content to be safe when capturing chunks of text.
+
Extends
~~~~~~~
View
3 test/Twig/Tests/Fixtures/tags/set/basic.test
@@ -2,8 +2,10 @@
"set" tag
--TEMPLATE--
{% set foo = 'foo' %}
+{% set bar = 'foo<br />' %}
{{ foo }}
+{{ bar }}
{% set foo, bar = 'foo', 'bar' %}
@@ -12,6 +14,7 @@
return array()
--EXPECT--
foo
+foo&lt;br /&gt;
foobar

0 comments on commit 1ac5075

Please sign in to comment.
Something went wrong with that request. Please try again.