mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-11 18:06:46 +00:00
updated CHANGELOG
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
* 2.7.3 (2019-XX-XX)
|
||||
|
||||
* n/a
|
||||
* fixed the spaceless filter so that it behaves like the spaceless tag
|
||||
* fixed BC break on Environment::resolveTemplate()
|
||||
|
||||
* 2.7.2 (2019-03-12)
|
||||
|
||||
@@ -181,6 +182,8 @@
|
||||
|
||||
* 1.38.3 (2019-XX-XX)
|
||||
|
||||
* fixed the spaceless filter so that it behaves like the spaceless tag
|
||||
* fixed BC break on Environment::resolveTemplate()
|
||||
* fixed the bundled Autoloader to also load namespaced classes
|
||||
|
||||
* 1.38.2 (2019-03-12)
|
||||
|
||||
+13
-3
@@ -496,7 +496,7 @@ class Environment
|
||||
*
|
||||
* @param string|TemplateWrapper|array $names A template or an array of templates to try consecutively
|
||||
*
|
||||
* @return TemplateWrapper
|
||||
* @return TemplateWrapper|Template
|
||||
*
|
||||
* @throws LoaderError When none of the templates can be found
|
||||
* @throws SyntaxError When an error occurred during compilation
|
||||
@@ -504,13 +504,23 @@ class Environment
|
||||
public function resolveTemplate($names)
|
||||
{
|
||||
if (!\is_array($names)) {
|
||||
return $this->load($names);
|
||||
$names = [$names];
|
||||
}
|
||||
|
||||
foreach ($names as $name) {
|
||||
if ($name instanceof Template) {
|
||||
return $name;
|
||||
}
|
||||
if ($name instanceof TemplateWrapper) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->load($name);
|
||||
return $this->loadTemplate($name);
|
||||
} catch (LoaderError $e) {
|
||||
if (1 === \count($names)) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -970,7 +970,7 @@ function twig_trim_filter($string, $characterMask = null, $side = 'both')
|
||||
*/
|
||||
function twig_spaceless($content)
|
||||
{
|
||||
return preg_replace('/>\s+</', '><', $content);
|
||||
return trim(preg_replace('/>\s+</', '><', $content));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
"set" tag
|
||||
--TEMPLATE--
|
||||
{% set foo = "foo" %}
|
||||
|
||||
{% set bar %}
|
||||
{%- set foo = "bar" -%}
|
||||
bar
|
||||
{% endset %}
|
||||
|
||||
{{ foo }}
|
||||
{{ bar }}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
bar
|
||||
bar
|
||||
Reference in New Issue
Block a user