backed out comment patch

This commit is contained in:
mohrt
2003-04-17 18:30:41 +00:00
parent 9736393913
commit 76a3ebd1a8
2 changed files with 6 additions and 13 deletions

1
NEWS
View File

@@ -1,4 +1,3 @@
- corrected output with smarty comments (Monte)
- corrected output with {strip} and PHP tag newlines (Monte) - corrected output with {strip} and PHP tag newlines (Monte)
- added possibility to register function-callbacks as "array(&$obj, 'method)" - added possibility to register function-callbacks as "array(&$obj, 'method)"
this affects register_function(), -block, -compiler_function, -modifier, this affects register_function(), -block, -compiler_function, -modifier,

View File

@@ -238,18 +238,8 @@ class Smarty_Compiler extends Smarty {
} }
/* Annihilate the comments. */ /* Annihilate the comments. */
$template_source = preg_replace("!({$ldq})\*(.*?)\*({$rdq})!se",
$_comment_search = array( "'\\1*'.str_repeat(\"\n\", substr_count('\\2', \"\n\")) .'*\\3'",
"!{$ldq}\*.*?\*{$rdq}!s", // get all onto one line
"!(\r|\r\n|\n)%%%SMARTY_COMMENT%%%(\r|\r\n|\n)!", // remove CR if on one line
'!%%%SMARTY_COMMENT%%%!'); // remove remaining comments
$_comment_replace = array(
'%%%SMARTY_COMMENT%%%',
'\\1',
'');
$template_source = preg_replace($_comment_search,
$_comment_replace,
$template_source); $template_source);
/* Pull out the literal blocks. */ /* Pull out the literal blocks. */
@@ -390,6 +380,10 @@ class Smarty_Compiler extends Smarty {
function _compile_tag($template_tag) function _compile_tag($template_tag)
{ {
/* Matched comment. */
if ($template_tag{0} == '*' && $template_tag{strlen($template_tag) - 1} == '*')
return '';
/* Split tag into two three parts: command, command modifiers and the arguments. */ /* Split tag into two three parts: command, command modifiers and the arguments. */
if(! preg_match('/^(?:(' . $this->_obj_call_regexp . '|' . $this->_var_regexp if(! preg_match('/^(?:(' . $this->_obj_call_regexp . '|' . $this->_var_regexp
. '|' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*)) . '|' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))