cvs: smarty /libs Smarty_Compiler.class.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1108048456@cvsserver> |
messju Thu Feb 10 10:14:16 2005 EDT
Modified files:
/smarty/libs Smarty_Compiler.class.php
Log:
fixed too agressive {strip} around delimiters inside strip-blocks
http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.362&r2=1.363&ty=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.362 smarty/libs/Smarty_Compiler.class.php:1.363
--- smarty/libs/Smarty_Compiler.class.php:1.362 Wed Feb 9 09:31:18 2005
+++ smarty/libs/Smarty_Compiler.class.php Thu Feb 10 10:14:15 2005
@@ -26,7 +26,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.362 2005/02/09 14:31:18 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.363 2005/02/10 15:14:15 messju Exp $ */
/**
* Template compiling class
@@ -325,14 +325,18 @@
if ($compiled_tags[$i] == '{strip}') {
$compiled_tags[$i] = '';
$strip = true;
+ /* remove leading whitespaces */
+ $text_blocks[$i + 1] = ltrim($text_blocks[$i + 1]);
}
if ($strip) {
/* strip all $text_blocks before the next '/strip' */
for ($j = $i + 1; $j < $for_max; $j++) {
/* remove leading and trailing whitespaces of each line */
- $text_blocks[$j] = preg_replace('!\s+$|^\s+!m', '', $text_blocks[$j]);
- /* remove carriage return and newline between each line */
- $text_blocks[$j] = preg_replace('![\r\n]+!m', '', $text_blocks[$j]);
+ $text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]);
+ if ($compiled_tags[$j] == '{/strip}') {
+ /* remove trailing whitespaces from the last text_block */
+ $text_blocks[$j] = rtrim($text_blocks[$j]);
+ }
$text_blocks[$j] = "<?php echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>";
if ($compiled_tags[$j] == '{/strip}') {
$compiled_tags[$j] = "\n"; /* slurped by php, but necessary
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php