cvs: smarty / NEWS /libs Smarty_Compiler.class.php

From: Date: Thu, 17 Apr 2003 18:30:41 +0000
Subject: cvs: smarty / NEWS /libs Smarty_Compiler.class.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-531@lists.php.net to get a copy of this message
mohrt Thu Apr 17 14:30:41 2003 EDT Modified files: /smarty NEWS /smarty/libs Smarty_Compiler.class.php Log: backed out comment patch Index: smarty/NEWS diff -u smarty/NEWS:1.340 smarty/NEWS:1.341 --- smarty/NEWS:1.340 Thu Apr 17 11:20:19 2003 +++ smarty/NEWS Thu Apr 17 14:30:41 2003 @@ -1,4 +1,3 @@ - - corrected output with smarty comments (Monte) - corrected output with {strip} and PHP tag newlines (Monte) - added possibility to register function-callbacks as "array(&$obj, 'method)" this affects register_function(), -block, -compiler_function, -modifier, Index: smarty/libs/Smarty_Compiler.class.php diff -u smarty/libs/Smarty_Compiler.class.php:1.209 smarty/libs/Smarty_Compiler.class.php:1.210 --- smarty/libs/Smarty_Compiler.class.php:1.209 Thu Apr 17 11:43:31 2003 +++ smarty/libs/Smarty_Compiler.class.php Thu Apr 17 14:30:41 2003 @@ -39,7 +39,7 @@ * @package Smarty */ -/* $Id: Smarty_Compiler.class.php,v 1.209 2003/04/17 15:43:31 mohrt Exp $ */ +/* $Id: Smarty_Compiler.class.php,v 1.210 2003/04/17 18:30:41 mohrt Exp $ */ class Smarty_Compiler extends Smarty { @@ -238,18 +238,8 @@ } /* Annihilate the comments. */ - - $_comment_search = array( - "!{$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 = preg_replace("!({$ldq})\*(.*?)\*({$rdq})!se", + "'\\1*'.str_repeat(\"\n\", substr_count('\\2', \"\n\")) .'*\\3'", $template_source); /* Pull out the literal blocks. */ @@ -389,6 +379,10 @@ */ 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. */ if(! preg_match('/^(?:(' . $this->_obj_call_regexp . '|' . $this->_var_regexp

« previous php.smarty.cvs (#531) next »