Changeset 784
- Timestamp:
- 02/28/08 22:05:30 (11 months ago)
- Files:
-
- trunk/lib/jelix/tpl/jTplCompiler.class.php (modified) (3 diffs)
- trunk/lib/jelix/tpl/jTplCompiler.class.php (modified) (3 diffs)
- trunk/lib/jelix/tpl/jTplCompiler.class.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jtpl.compiler.html_cli.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jtpl.compiler.html_cli.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jtpl.compiler.html_cli.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/tpl/jTplCompiler.class.php
r742 r784 190 190 $tplcontent = preg_replace("!{literal}(.*?){/literal}!s", '{literal}', $tplcontent); 191 191 192 $tplcontent = preg_replace_callback("/{((.).*?)}/s ", array($this,'_callback'), $tplcontent);192 $tplcontent = preg_replace_callback("/{((.).*?)}/sm", array($this,'_callback'), $tplcontent); 193 193 194 194 $tplcontent = preg_replace('/\?>\n?<\?php/', '', $tplcontent); … … 224 224 return ''; 225 225 } else { 226 if (!preg_match('/^(\/?[a-zA-Z0-9_]+)(?:(?:\s+(.*))|(?:\((.*)\)))?$/ ',$tag,$m)) {226 if (!preg_match('/^(\/?[a-zA-Z0-9_]+)(?:(?:\s+(.*))|(?:\((.*)\)))?$/ms',$tag,$m)) { 227 227 #if JTPL_STANDALONE 228 228 throw new Exception(sprintf($this->_locales['errors.tpl.tag.function.invalid'], $tag, $this->_sourceFile)); … … 447 447 $this->doError2('errors.tpl.tag.constant.notallowed', $this->_currentTag, $str); 448 448 } 449 if($type == T_WHITESPACE) 450 $str = preg_replace("/(\s+)/ms"," ",$str); 449 451 $result.=$str; 450 452 }else{ trunk/lib/jelix/tpl/jTplCompiler.class.php
r742 r784 190 190 $tplcontent = preg_replace("!{literal}(.*?){/literal}!s", '{literal}', $tplcontent); 191 191 192 $tplcontent = preg_replace_callback("/{((.).*?)}/s ", array($this,'_callback'), $tplcontent);192 $tplcontent = preg_replace_callback("/{((.).*?)}/sm", array($this,'_callback'), $tplcontent); 193 193 194 194 $tplcontent = preg_replace('/\?>\n?<\?php/', '', $tplcontent); … … 224 224 return ''; 225 225 } else { 226 if (!preg_match('/^(\/?[a-zA-Z0-9_]+)(?:(?:\s+(.*))|(?:\((.*)\)))?$/ ',$tag,$m)) {226 if (!preg_match('/^(\/?[a-zA-Z0-9_]+)(?:(?:\s+(.*))|(?:\((.*)\)))?$/ms',$tag,$m)) { 227 227 #if JTPL_STANDALONE 228 228 throw new Exception(sprintf($this->_locales['errors.tpl.tag.function.invalid'], $tag, $this->_sourceFile)); … … 447 447 $this->doError2('errors.tpl.tag.constant.notallowed', $this->_currentTag, $str); 448 448 } 449 if($type == T_WHITESPACE) 450 $str = preg_replace("/(\s+)/ms"," ",$str); 449 451 $result.=$str; 450 452 }else{ trunk/lib/jelix/tpl/jTplCompiler.class.php
r742 r784 190 190 $tplcontent = preg_replace("!{literal}(.*?){/literal}!s", '{literal}', $tplcontent); 191 191 192 $tplcontent = preg_replace_callback("/{((.).*?)}/s ", array($this,'_callback'), $tplcontent);192 $tplcontent = preg_replace_callback("/{((.).*?)}/sm", array($this,'_callback'), $tplcontent); 193 193 194 194 $tplcontent = preg_replace('/\?>\n?<\?php/', '', $tplcontent); … … 224 224 return ''; 225 225 } else { 226 if (!preg_match('/^(\/?[a-zA-Z0-9_]+)(?:(?:\s+(.*))|(?:\((.*)\)))?$/ ',$tag,$m)) {226 if (!preg_match('/^(\/?[a-zA-Z0-9_]+)(?:(?:\s+(.*))|(?:\((.*)\)))?$/ms',$tag,$m)) { 227 227 #if JTPL_STANDALONE 228 228 throw new Exception(sprintf($this->_locales['errors.tpl.tag.function.invalid'], $tag, $this->_sourceFile)); … … 447 447 $this->doError2('errors.tpl.tag.constant.notallowed', $this->_currentTag, $str); 448 448 } 449 if($type == T_WHITESPACE) 450 $str = preg_replace("/(\s+)/ms"," ",$str); 449 451 $result.=$str; 450 452 }else{ trunk/testapp/modules/jelix_tests/tests/jtpl.compiler.html_cli.php
r742 r784 124 124 '<p>ok <?php if(jAuth::isConnected()):?> connected <?php else:?> not connected <?php endif; ?></p>', 125 125 ), 126 5=>array( 127 '<p>ok {zone $truc, 128 array(\'toto\'=>4, 129 \'bla\'=>\'foo\') 130 }</p>', 131 '<p>ok <?php echo jZone::get($t->_vars[\'truc\'], array(\'toto\'=>4, \'bla\'=>\'foo\') );?></p>', 132 ), 133 6=>array( 134 '<p>ok {zone $truc, 135 array(\'toto\'=>4, 136 \'bla\'=>\'foo\') 137 }</p><div>{counter_init \'name\', \'0\', 1, 1}</div>', 138 '<p>ok <?php echo jZone::get($t->_vars[\'truc\'], array(\'toto\'=>4, \'bla\'=>\'foo\') );?></p><div><?php jtpl_function_common_counter_init( $t,\'name\', \'0\', 1, 1);?></div>', 139 ), 126 140 127 141 ); … … 141 155 } 142 156 } 143 157 144 158 protected $tplerrors = array( 145 159 0=>array('{if}', … … 148 162 'jelix~errors.tpl.tag.block.end.missing',array('ifuserconnected',null) ), 149 163 ); 150 164 151 165 function testCompileErrors() { 152 166 $compil = new testJtplContentCompiler(); trunk/testapp/modules/jelix_tests/tests/jtpl.compiler.html_cli.php
r742 r784 124 124 '<p>ok <?php if(jAuth::isConnected()):?> connected <?php else:?> not connected <?php endif; ?></p>', 125 125 ), 126 5=>array( 127 '<p>ok {zone $truc, 128 array(\'toto\'=>4, 129 \'bla\'=>\'foo\') 130 }</p>', 131 '<p>ok <?php echo jZone::get($t->_vars[\'truc\'], array(\'toto\'=>4, \'bla\'=>\'foo\') );?></p>', 132 ), 133 6=>array( 134 '<p>ok {zone $truc, 135 array(\'toto\'=>4, 136 \'bla\'=>\'foo\') 137 }</p><div>{counter_init \'name\', \'0\', 1, 1}</div>', 138 '<p>ok <?php echo jZone::get($t->_vars[\'truc\'], array(\'toto\'=>4, \'bla\'=>\'foo\') );?></p><div><?php jtpl_function_common_counter_init( $t,\'name\', \'0\', 1, 1);?></div>', 139 ), 126 140 127 141 ); … … 141 155 } 142 156 } 143 157 144 158 protected $tplerrors = array( 145 159 0=>array('{if}', … … 148 162 'jelix~errors.tpl.tag.block.end.missing',array('ifuserconnected',null) ), 149 163 ); 150 164 151 165 function testCompileErrors() { 152 166 $compil = new testJtplContentCompiler(); trunk/testapp/modules/jelix_tests/tests/jtpl.compiler.html_cli.php
r742 r784 124 124 '<p>ok <?php if(jAuth::isConnected()):?> connected <?php else:?> not connected <?php endif; ?></p>', 125 125 ), 126 5=>array( 127 '<p>ok {zone $truc, 128 array(\'toto\'=>4, 129 \'bla\'=>\'foo\') 130 }</p>', 131 '<p>ok <?php echo jZone::get($t->_vars[\'truc\'], array(\'toto\'=>4, \'bla\'=>\'foo\') );?></p>', 132 ), 133 6=>array( 134 '<p>ok {zone $truc, 135 array(\'toto\'=>4, 136 \'bla\'=>\'foo\') 137 }</p><div>{counter_init \'name\', \'0\', 1, 1}</div>', 138 '<p>ok <?php echo jZone::get($t->_vars[\'truc\'], array(\'toto\'=>4, \'bla\'=>\'foo\') );?></p><div><?php jtpl_function_common_counter_init( $t,\'name\', \'0\', 1, 1);?></div>', 139 ), 126 140 127 141 ); … … 141 155 } 142 156 } 143 157 144 158 protected $tplerrors = array( 145 159 0=>array('{if}', … … 148 162 'jelix~errors.tpl.tag.block.end.missing',array('ifuserconnected',null) ), 149 163 ); 150 164 151 165 function testCompileErrors() { 152 166 $compil = new testJtplContentCompiler();
