- bugfix {strip} must keep space between hmtl tags. Broken by changes of 10.2.2016 https://github.com/smarty-php/smarty/issues/184

This commit is contained in:
uwetews
2016-02-20 17:24:48 +01:00
parent 3e463c1be0
commit a884855818
3 changed files with 7 additions and 6 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.30-dev ===== (xx.xx.xx)  ===== 3.1.30-dev ===== (xx.xx.xx)
20.02.2016
- bugfix {strip} must keep space between hmtl tags. Broken by changes of 10.2.2016 https://github.com/smarty-php/smarty/issues/184
19.02.2016 19.02.2016
- revert output buffer flushing on display, echo content again because possible problems when PHP files had - revert output buffer flushing on display, echo content again because possible problems when PHP files had
characters (newline} after ?> at file end https://github.com/smarty-php/smarty/issues/187 characters (newline} after ?> at file end https://github.com/smarty-php/smarty/issues/187

View File

@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.30-dev/45'; const SMARTY_VERSION = '3.1.30-dev/46';
/** /**
* define variable scopes * define variable scopes

View File

@@ -818,14 +818,13 @@ abstract class Smarty_Internal_TemplateCompilerBase
$_store ++; $_store ++;
} }
} }
$expressions = array(// replace multiple spaces between tags by a single space $expressions = array(// replace multiple spaces between tags by a single space
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements // can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2', '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
// remove spaces between attributes (but not in attribute values!) // remove spaces between attributes (but not in attribute values!)
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5', '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
'#^\s+<#Ss' => $this->has_output ? ' <' : '<', '#>[\040\011]+$#Ss' => '> ', '#>[\040\011]+$#Ss' => '> ', '#>[\040\011]*[\n]\s*$#Ss' => '>',
'#>[\040\011]*[\n]\s*$#Ss' => '>', $this->stripRegEx => '',); $this->stripRegEx => '',);
$text = preg_replace(array_keys($expressions), array_values($expressions), $text); $text = preg_replace(array_keys($expressions), array_values($expressions), $text);
$_offset = 0; $_offset = 0;
@@ -844,7 +843,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
$text = preg_replace($this->stripRegEx, '', $text); $text = preg_replace($this->stripRegEx, '', $text);
} }
} }
$this->has_output = false;
return new Smarty_Internal_ParseTree_Text($text); return new Smarty_Internal_ParseTree_Text($text);
} }
return null; return null;