Skip to content

Commit

Permalink
- bugfix {strip} must keep space between hmtl tags. Broken by changes…
Browse files Browse the repository at this point in the history
… of 10.2.2016 #184
  • Loading branch information
uwetews committed Feb 20, 2016
1 parent 3e463c1 commit a884855
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
 ===== 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
- 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
Expand Down
2 changes: 1 addition & 1 deletion libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.30-dev/45';
const SMARTY_VERSION = '3.1.30-dev/46';

/**
* define variable scopes
Expand Down
8 changes: 3 additions & 5 deletions libs/sysplugins/smarty_internal_templatecompilerbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,14 +818,13 @@ public function processText($text)
$_store ++;
}
}

$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
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1\2',
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
// remove spaces between attributes (but not in attribute values!)
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
'#^\s+<#Ss' => $this->has_output ? ' <' : '<', '#>[\040\011]+$#Ss' => '> ',
'#>[\040\011]*[\n]\s*$#Ss' => '>', $this->stripRegEx => '',);
'#>[\040\011]+$#Ss' => '> ', '#>[\040\011]*[\n]\s*$#Ss' => '>',
$this->stripRegEx => '',);

$text = preg_replace(array_keys($expressions), array_values($expressions), $text);
$_offset = 0;
Expand All @@ -844,7 +843,6 @@ public function processText($text)
$text = preg_replace($this->stripRegEx, '', $text);
}
}
$this->has_output = false;
return new Smarty_Internal_ParseTree_Text($text);
}
return null;
Expand Down

0 comments on commit a884855

Please sign in to comment.