From 5259481be530481ce7fdd535757e19326201c6e1 Mon Sep 17 00:00:00 2001 From: messju Date: Tue, 2 Sep 2003 10:29:50 +0000 Subject: [PATCH] ignore {strip}/{/strip) inside {strip}-blocks --- NEWS | 1 + libs/Smarty_Compiler.class.php | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index e2d28e0c..ac82b47e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - ignore {strip}/{/strip) inside {strip}-blocks (messju) - fixed removal of leading/trailing newlines in {strip}-blocks (messju) - fixed proper escaping of " and ' with escape:javascript (messju) - fixed bug in traversal of $smarty->plugins_dir-array. now the diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 34b40e67..f67ce799 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -508,12 +508,18 @@ class Smarty_Compiler extends Smarty { case 'strip': case '/strip': - if ($tag_command{0}=='/') - $this->_strip_depth--; - else - $this->_strip_depth++; - $this->_additional_newline = ($this->_strip_depth>0) ? '' : "\n"; - return $this->left_delimiter.$tag_command.$this->right_delimiter; + if ($tag_command{0}=='/') { + if (--$this->_strip_depth==0) { /* outermost closing {/strip} */ + $this->_additional_newline = "\n"; + return $this->left_delimiter.$tag_command.$this->right_delimiter; + } + } else { + if ($this->_strip_depth++==0) { /* outermost opening {strip} */ + $this->_additional_newline = ""; + return $this->left_delimiter.$tag_command.$this->right_delimiter; + } + } + return ''; case 'literal': list (,$literal_block) = each($this->_literal_blocks);