Merge branch '1.x' into 2.x

* 1.x:
  updated CHANGELOG
  fixed typo
  feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output
  bumped version to 1.31.0
  Delay marking the environment as initialized until it is done
  Fix the argument name of filter replace
This commit is contained in:
Fabien Potencier
2017-01-10 14:07:32 -08:00
6 changed files with 29 additions and 7 deletions
+4 -2
View File
@@ -23,9 +23,11 @@
* improved the performance of the filesystem loader
* removed features that were deprecated in 1.x
* 1.30.1 (2017-XX-XX)
* 1.31.0 (2017-XX-XX)
* n/a
* added Twig_NodeCaptureInterface for nodes that capture all output
* fixed marking the environment as initialized too early
* fixed C89 compat for the C extension
* 1.30.0 (2016-12-23)
+1 -1
View File
@@ -14,6 +14,6 @@ The ``replace`` filter formats a given string by replacing the placeholders
Arguments
---------
* ``replace_pairs``: The placeholder values
* ``from``: The placeholder values
.. seealso:: :doc:`format<format>`
+2 -1
View File
@@ -407,7 +407,6 @@ final class Twig_ExtensionSet
private function initExtensions()
{
$this->initialized = true;
$this->parsers = array();
$this->filters = array();
$this->functions = array();
@@ -420,6 +419,8 @@ final class Twig_ExtensionSet
$this->initExtension($extension);
}
$this->initExtension($this->staging);
// Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception
$this->initialized = true;
}
private function initExtension(Twig_ExtensionInterface $extension)
+1 -1
View File
@@ -14,7 +14,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Twig_Node_Set extends Twig_Node
class Twig_Node_Set extends Twig_Node implements Twig_NodeCaptureInterface
{
public function __construct($capture, Twig_Node $names, Twig_Node $values, $lineno, $tag = null)
{
+19
View File
@@ -0,0 +1,19 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Represents a node that captures any nested displayable nodes.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface Twig_NodeCaptureInterface
{
}
+2 -2
View File
@@ -326,8 +326,8 @@ class Twig_Parser
throw new Twig_Error_Syntax('A template that extends another one cannot include contents outside Twig blocks. Did you forget to put the contents inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext());
}
// bypass "set" nodes as they "capture" the output
if ($node instanceof Twig_Node_Set) {
// bypass nodes that will "capture" the output
if ($node instanceof Twig_NodeCaptureInterface) {
return $node;
}