[limb-svn] r7010 - in 3.x/trunk/limb/macro: src/tags/list tests/cases/tags/list
svn at limb-project.com
svn at limb-project.com
Tue May 13 10:26:02 MSD 2008
Author: serega
Date: 2008-05-13 10:26:02 +0400 (Tue, 13 May 2008)
New Revision: 7010
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7010
Modified:
3.x/trunk/limb/macro/src/tags/list/list_glue.tag.php
3.x/trunk/limb/macro/tests/cases/tags/list/lmbMacroListTagTest.class.php
Log:
-- now {{list:glue}} tag can be independent from other separators if "independent" attribute with "true" value is used. See lmbMacroListTagTest :: testIndependentGlue()
Modified: 3.x/trunk/limb/macro/src/tags/list/list_glue.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/list/list_glue.tag.php 2008-05-12 21:27:12 UTC (rev 7009)
+++ 3.x/trunk/limb/macro/src/tags/list/list_glue.tag.php 2008-05-13 06:26:02 UTC (rev 7010)
@@ -67,7 +67,7 @@
{
foreach($separators as $separator)
{
- if($separator->getNodeId() != $this->getNodeId())
+ if(!$separator->isIndependent() && $separator->getNodeId() != $this->getNodeId())
{
$code->writePhp('if (' . $separator->getStepVar($code) . ' < ' . $step_var . ') ');
$code->writePhp($separator->getHelperVar($code) . "->skipNext();\n");
@@ -79,6 +79,11 @@
$code->writePhp("}\n");
}
+
+ function isIndependent()
+ {
+ return $this->has('independent') && $this->getBool('independent');
+ }
function getStepVar($code)
{
Modified: 3.x/trunk/limb/macro/tests/cases/tags/list/lmbMacroListTagTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/tags/list/lmbMacroListTagTest.class.php 2008-05-12 21:27:12 UTC (rev 7009)
+++ 3.x/trunk/limb/macro/tests/cases/tags/list/lmbMacroListTagTest.class.php 2008-05-13 06:26:02 UTC (rev 7010)
@@ -178,6 +178,23 @@
$this->assertEqual($macro->render(), 'List#John:Pavel|Peter:Harry|Roman:Sergey!');
}
+ function testIndependentGlue()
+ {
+ $list = '{{list using="$#list" as="$item"}}List#'.
+ '{{list:item}}<?=$item?>' .
+ '{{list:glue step="2" independent="true"}}:{{/list:glue}}'.
+ '{{list:glue step="3"}}|{{/list:glue}}'.
+ '{{/list:item}}!'.
+ '{{/list}}';
+
+ $list_tpl = $this->_createTemplate($list, 'list.html');
+
+ $macro = $this->_createMacro($list_tpl);
+ $macro->set('list', array('John', 'Pavel', 'Peter', 'Harry', 'Roman', 'Sergey', 'Alex', 'Vlad'));
+
+ $this->assertEqual($macro->render(), 'List#JohnPavel:Peter|Harry:RomanSergey:|AlexVlad!');
+ }
+
function testTwoGluesInsideNestingLists()
{
$list = '{{list using="$#list1" as="$item1"}}'.
More information about the limb-svn
mailing list