* 0.9.7-DEV
+Backward incompatibilities:
+ * The short notation of the `block` tag changed.
+
+ * added a 'as' string to the block tag short notation ({% block title "Title" %} must now be {% block title as "Title" %})
* added an exception when a child template has a non-empty body (as it is always ignored when rendering)
* 0.9.6 (2010-05-12)
-
[twig]
- {% block title page_title|title %}
-
-Note that as soon as you specify a second argument it's treated as short block
-and Twig won't look for a closing tag.
+ {% block title as page_title|title %}
Import Context Behavior
-----------------------
}
}
} else {
+ $stream->expect(Twig_Token::NAME_TYPE, 'as');
+
$body = new Twig_NodeList(array(
new Twig_Node_Print($this->parser->getExpressionParser()->parseExpression(), $lineno),
));
<?php
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009-2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
class Twig_TokenParser_Debug extends Twig_TokenParser
{
public function parse(Twig_Token $token)
$capture = false;
if ($stream->test(Twig_Token::NAME_TYPE, 'as')) {
- $stream->expect(Twig_Token::NAME_TYPE, 'as');
+ $stream->next();
list(, $values) = $this->parser->getExpressionParser()->parseMultitargetExpression();
$stream->expect(Twig_Token::BLOCK_END_TYPE);
"block" tag
--TEMPLATE--
{% block title1 %}FOO{% endblock %}
-{% block title2 foo|lower %}
+{% block title2 as foo|lower %}
--TEMPLATE(foo.twig)--
{% block content %}{% endblock %}
--DATA--