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

svn at limb-project.com svn at limb-project.com
Mon Feb 11 02:21:51 MSK 2008


Author: pachanga
Date: 2008-02-11 02:21:51 +0300 (Mon, 11 Feb 2008)
New Revision: 6787
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6787

Modified:
   3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php
   3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php
   3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateTest.class.php
Log:
-- adding special case for <?xml .. ?> markup

Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php	2008-02-08 15:29:56 UTC (rev 6786)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroPreprocessor.class.php	2008-02-10 23:21:51 UTC (rev 6787)
@@ -19,7 +19,7 @@
   function process(&$contents)
   {
     $contents = str_replace('<?=', '<?php echo ', $contents);
-    $contents = preg_replace('~<\?(?!php|=)~', '<?php ', $contents);    
+    $contents = preg_replace('~<\?(?!php|=|xml)~', '<?php ', $contents);    
     $contents = str_replace('$#', '$this->', $contents);
   }
 }

Modified: 3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php	2008-02-08 15:29:56 UTC (rev 6786)
+++ 3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php	2008-02-10 23:21:51 UTC (rev 6787)
@@ -11,7 +11,6 @@
 lmb_require('limb/macro/src/lmbMacroTemplateLocator.class.php');
 lmb_require('limb/macro/src/lmbMacroException.class.php');
 
-
 /**
  * class lmbMacroTemplate.
  *

Modified: 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateTest.class.php	2008-02-08 15:29:56 UTC (rev 6786)
+++ 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTemplateTest.class.php	2008-02-10 23:21:51 UTC (rev 6787)
@@ -9,24 +9,33 @@
  
 class lmbMacroTemplateTest extends lmbBaseMacroTest
 {  
-  function testRenderTemplateVar()
+  function testPreprocessor_LeavePHPFullTagsAsIs()
   {
     $view = $this->_createMacroTemplate('Hello, <?php echo $this->name;?>');
     $view->set('name', 'Bob');
     $this->assertEqual($view->render(), 'Hello, Bob');
   }
 
-  function testShortTagsPreprocessor()
+  function testPreprocessor_ProcessPHPShortTags()
   {
-    if(ini_get('short_open_tag') == 1)
-      echo __METHOD__ . " does not check anything, since short tags are On anyway\n";
-
+    $view = $this->_createMacroTemplate('Hello, <?echo "Bob";?>');    
+    $this->assertEqual($view->render(), 'Hello, Bob');
+  }
+  
+  function testPreprocessor_LeaveXmlTagAsIs()
+  {
+    $view = $this->_createMacroTemplate("<?xml version='1.0' encoding='utf-8'?>");    
+    $this->assertEqual($view->render(), "<?xml version='1.0' encoding='utf-8'?>");
+  }  
+  
+  function testPreprocessor_ProcessPHPShortOutputTags()
+  {
     $view = $this->_createMacroTemplate('Hello, <?=$this->name?>');
     $view->set('name', 'Bob');
     $this->assertEqual($view->render(), 'Hello, Bob');
-  }
+  }  
 
-  function testGlobalVarsPreprocessor()
+  function testPreprocessor_ReplaceGlobalVars()
   {
     $view = $this->_createMacroTemplate('Hello, <?=$#name?>');
     $view->set('name', 'Bob');



More information about the limb-svn mailing list