From 417088bdb7c68ad4d71aef4c003f1b079945e325 Mon Sep 17 00:00:00 2001 From: uwetews Date: Wed, 10 Feb 2016 03:17:32 +0100 Subject: [PATCH] - bugfix {strip} must keep space on output creating smarty tags within html tags https://github.com/smarty-php/smarty/issues/177 --- libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_internal_templatecompilerbase.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 0de3fdc9..914d8669 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.30-dev/32'; + const SMARTY_VERSION = '3.1.30-dev/34'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 6d3f0802..87a92be9 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -796,9 +796,6 @@ abstract class Smarty_Internal_TemplateCompilerBase $_store = 0; $space = ''; if ($this->parser->strip) { - $space = $this->has_output && preg_match('/^\040|\011/', $text) ? ' ' : ''; - $this->has_output = false; - if (strpos($text, '<') !== false) { // capture html elements not to be messed with $_offset = 0; @@ -838,6 +835,9 @@ abstract class Smarty_Internal_TemplateCompilerBase } else { $text = preg_replace($this->stripRegEx, '', $text); } + $space = $this->has_output && !preg_match('/^\s/', $text) ? ' ' : ''; + $this->has_output = false; + } return new Smarty_Internal_ParseTree_Text($space . $text); }