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

[email protected] ("boots") Tue, 09 May 2006 19:57:30 -0000
Newsgroups php.smarty.cvs
Message-ID <cvsboots1147204650@cvsserver>
boots		Tue May  9 19:57:30 2006 UTC

  Modified files:              
    /smarty	NEWS 
    /smarty/libs	Smarty_Compiler.class.php 
  Log:
  separate handling of comment blocks from "special blocks"
  
http://cvs.php.net/viewcvs.cgi/smarty/NEWS?r1=1.529&r2=1.530&diff_format=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.529 smarty/NEWS:1.530
--- smarty/NEWS:1.529	Tue May  9 19:48:54 2006
+++ smarty/NEWS	Tue May  9 19:57:30 2006
@@ -1,3 +1,4 @@
+- separate handling of comment blocks from 'special blocks' (boots)
 - fix handling of block-methods of registered objects (El Hombre Gris,
   messju)
 
http://cvs.php.net/viewcvs.cgi/smarty/libs/Smarty_Compiler.class.php?r1=1.379&r2=1.380&diff_format=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.379 smarty/libs/Smarty_Compiler.class.php:1.380
--- smarty/libs/Smarty_Compiler.class.php:1.379	Sat Apr 22 08:16:57 2006
+++ smarty/libs/Smarty_Compiler.class.php	Tue May  9 19:57:30 2006
@@ -26,7 +26,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.379 2006/04/22 08:16:57 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.380 2006/05/09 19:57:30 boots Exp $ */
 
 /**
  * Template compiling class
@@ -240,6 +240,9 @@
         $ldq = preg_quote($this->left_delimiter, '~');
         $rdq = preg_quote($this->right_delimiter, '~');
 
+        /* kill comments */
+        $source_content = preg_replace("~{$ldq}\*(.*?)\*{$rdq}~", '', $source_content);
+
         // run template source through prefilter functions
         if (count($this->_plugins['prefilter']) > 0) {
             foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
@@ -255,7 +258,7 @@
         }
 
         /* fetch all special blocks */
-        $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s";
+        $search = "~{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s";
 
         preg_match_all($search, $source_content, $match,  PREG_SET_ORDER);
         $this->_folded_blocks = $match;