From: nikic <+@ni-po.com> Date: Wed, 9 Feb 2011 17:27:28 +0000 (+0100) Subject: capturing {% set %} should give Twig_Markup X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=01b8c7cfae6e9704f748046371179101fdf19624;p=web%2Fkonrad%2Ftwig.git capturing {% set %} should give Twig_Markup --- diff --git a/lib/Twig/Node/Set.php b/lib/Twig/Node/Set.php index 04be00e..9dae2ea 100644 --- a/lib/Twig/Node/Set.php +++ b/lib/Twig/Node/Set.php @@ -52,7 +52,7 @@ class Twig_Node_Set extends Twig_Node $compiler->subcompile($this->getNode('names'), false); if ($this->getAttribute('capture')) { - $compiler->raw(" = ob_get_clean()"); + $compiler->raw(" = new Twig_Markup(ob_get_clean())"); } } diff --git a/test/Twig/Tests/Fixtures/tags/set/capture.test b/test/Twig/Tests/Fixtures/tags/set/capture.test index 4408ca8..f156a1a 100644 --- a/test/Twig/Tests/Fixtures/tags/set/capture.test +++ b/test/Twig/Tests/Fixtures/tags/set/capture.test @@ -1,10 +1,10 @@ --TEST-- "set" tag block capture --TEMPLATE-- -{% set foo %}foo{% endset %} +{% set foo %}f
o
o{% endset %} {{ foo }} --DATA-- return array() --EXPECT-- -foo +f
o
o diff --git a/test/Twig/Tests/Node/SetTest.php b/test/Twig/Tests/Node/SetTest.php index 7883fba..6f61922 100644 --- a/test/Twig/Tests/Node/SetTest.php +++ b/test/Twig/Tests/Node/SetTest.php @@ -51,7 +51,7 @@ class Twig_Tests_Node_SetTest extends Twig_Tests_Node_TestCase $tests[] = array($node, <<