[limb-svn] r6940 - in 3.x/trunk/limb/macro: src/compiler tests/cases/compiler

svn at limb-project.com svn at limb-project.com
Thu Apr 17 12:57:37 MSD 2008


Author: serega
Date: 2008-04-17 12:57:37 +0400 (Thu, 17 Apr 2008)
New Revision: 6940
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6940

Modified:
   3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php
   3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizer.class.php
   3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagAcceptanceTest.class.php
Log:
-- fixed a bug in lmbMacroTokenizer that incorrectly processes php blocks in some cases.

Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php	2008-04-17 07:14:44 UTC (rev 6939)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php	2008-04-17 08:57:37 UTC (rev 6940)
@@ -26,6 +26,6 @@
   
   function xmlSpecialCase($matches)
   {    
-    return '<?php echo "' . str_replace('"', '\"', $matches[1]) . '";?>'; 
+    return '<?php echo "' . str_replace('"', '\"', $matches[1]) . '"; ?>'; 
   }
 }

Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizer.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizer.class.php	2008-04-17 07:14:44 UTC (rev 6939)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizer.class.php	2008-04-17 08:57:37 UTC (rev 6940)
@@ -81,7 +81,7 @@
       //php found
       else
       {
-        $php_end = strpos($this->rawtext, '?>', $start);
+        $php_end = strpos($this->rawtext, '?>', $php_start);
         //php end found
         if($php_end !== false)
         {

Modified: 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagAcceptanceTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagAcceptanceTest.class.php	2008-04-17 07:14:44 UTC (rev 6939)
+++ 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagAcceptanceTest.class.php	2008-04-17 08:57:37 UTC (rev 6940)
@@ -53,6 +53,14 @@
     $this->assertEqual($out, '<h1>foo!bar</h1>');
   }
 
+ function testTagsInsideXmlBlock_WithOtherPhpBlockNearby()
+  {
+    $code = '<?xml version="1.0" encoding="utf-8" ?><h1><?php echo "hi!"; ?>{{foo/}}{{bar/}}</h1>';
+    $tpl = $this->_createMacroTemplate($code, 'tpl.html');
+    $out = $tpl->render();
+    $this->assertEqual($out, '<?xml version="1.0" encoding="utf-8" ?><h1>hi!foo!bar</h1>');
+  }
+
   function testCompositeTagAttributes()
   {
     $code = '<h1>{{zoo attr="Test_{$#var}_{$#foo}"/}}</h1>';



More information about the limb-svn mailing list