[limb-svn] r6527 - in 3.x/trunk/limb/macro: src src/tags/core src/tags/list src/tags/pager tests/cases
svn at limb-project.com
svn at limb-project.com
Mon Nov 19 10:45:10 MSK 2007
Author: serega
Date: 2007-11-19 10:45:09 +0300 (Mon, 19 Nov 2007)
New Revision: 6527
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6527
Modified:
3.x/trunk/limb/macro/src/lmbMacroTagDictionary.class.php
3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php
3.x/trunk/limb/macro/src/tags/core/apply.tag.php
3.x/trunk/limb/macro/src/tags/core/include.tag.php
3.x/trunk/limb/macro/src/tags/core/template.tag.php
3.x/trunk/limb/macro/src/tags/core/wrap.tag.php
3.x/trunk/limb/macro/src/tags/list/list.tag.php
3.x/trunk/limb/macro/src/tags/list/list_empty.tag.php
3.x/trunk/limb/macro/src/tags/list/list_even.tag.php
3.x/trunk/limb/macro/src/tags/list/list_fill.tag.php
3.x/trunk/limb/macro/src/tags/list/list_glue.tag.php
3.x/trunk/limb/macro/src/tags/list/list_item.tag.php
3.x/trunk/limb/macro/src/tags/list/list_odd.tag.php
3.x/trunk/limb/macro/src/tags/pager/current.tag.php
3.x/trunk/limb/macro/src/tags/pager/elipses.tag.php
3.x/trunk/limb/macro/src/tags/pager/first.tag.php
3.x/trunk/limb/macro/src/tags/pager/first_disabled.tag.php
3.x/trunk/limb/macro/src/tags/pager/last.tag.php
3.x/trunk/limb/macro/src/tags/pager/last_disabled.tag.php
3.x/trunk/limb/macro/src/tags/pager/next.tag.php
3.x/trunk/limb/macro/src/tags/pager/next_disabled.tag.php
3.x/trunk/limb/macro/src/tags/pager/number.tag.php
3.x/trunk/limb/macro/src/tags/pager/paginate.tag.php
3.x/trunk/limb/macro/src/tags/pager/prev.tag.php
3.x/trunk/limb/macro/src/tags/pager/prev_disabled.tag.php
3.x/trunk/limb/macro/src/tags/pager/section.tag.php
3.x/trunk/limb/macro/src/tags/pager/separator.tag.php
3.x/trunk/limb/macro/tests/cases/lmbMacroFilterDictionaryTest.class.php
3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php
Log:
-- added support for tag name aliases
-- now tag info reads "req_attributes", "forbid_end_tag", "restrict_self_nesting" and "parent_tag_class" annotations from tag file
-- added appropriate annotations to tags files
-- several small fixes
Modified: 3.x/trunk/limb/macro/src/lmbMacroTagDictionary.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTagDictionary.class.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/lmbMacroTagDictionary.class.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -62,14 +62,25 @@
return $dirs;
}
- function register($taginfo)
+ function register($tag_info)
{
- $tag_to_lower = strtolower($taginfo->getTag());
+ $names = array(strtolower($tag_info->getTag()));
- if(isset($this->info[$tag_to_lower]))
- return;
-
- $this->info[$tag_to_lower] = $taginfo;
+ $aliases = $tag_info->getAliases();
+ if(count($aliases))
+ {
+ $aliases = array_map('strtolower', $aliases);
+
+ $names = array_merge($names, $aliases);
+ }
+
+ foreach($names as $tag_name)
+ {
+ if(isset($this->info[$tag_name]))
+ return;
+
+ $this->info[$tag_name] = $tag_info;
+ }
}
function registerFromFile($file)
Modified: 3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -20,6 +20,7 @@
protected $tag;
protected $class;
protected $file;
+ protected $aliases = array();
protected $req_attributes = array();
protected $parent_class;
protected $restrict_self_nesting = false;
@@ -42,9 +43,29 @@
$info->setFile($file);
- if(isset($annotations['endtag']) && $annotations['endtag'] == 'no')
+ if(isset($annotations['forbid_end_tag']))
$info->setForbidEndtag(true);
+ if(isset($annotations['restrict_self_nesting']))
+ $info->setRestrictSelfNesting(true);
+
+ if(isset($annotations['parent_tag_class']))
+ $info->setParentClass(trim($annotations['parent_tag_class']));
+
+ if(isset($annotations['req_attributes']))
+ {
+ $req_attributes = explode(',' , $annotations['req_attributes']);
+ $req_attributes = array_map('trim', $req_attributes);
+ $info->setRequiredAttributes($req_attributes);
+ }
+
+ if(isset($annotations['aliases']))
+ {
+ $filter_aliases = explode(',' , $annotations['aliases']);
+ $filter_aliases = array_map('trim', $filter_aliases);
+ $info->setAliases($filter_aliases);
+ }
+
return $info;
}
@@ -98,6 +119,16 @@
return $this->parent_class;
}
+ function setAliases($aliases)
+ {
+ $this->aliases = $aliases;
+ }
+
+ function getAliases()
+ {
+ return $this->aliases;
+ }
+
function setRestrictSelfNesting($flag = true)
{
$this->restrict_self_nesting = $flag;
Modified: 3.x/trunk/limb/macro/src/tags/core/apply.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/apply.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/core/apply.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -11,6 +11,7 @@
/**
* @tag apply
+ * @req_attributes template
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/core/include.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/include.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/core/include.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -13,6 +13,7 @@
* class lmbMacroIncludeTag.
*
* @tag include
+ * @req_attributes file
* @package macro
* @version $Id$
*/
@@ -24,8 +25,7 @@
$locator = $compiler->getTemplateLocator();
- if(!$file = $this->get('file'))
- $this->raiseRequiredAttributeError($file);
+ $file = $this->get('file');
if(!$this->_isDynamic())
{
Modified: 3.x/trunk/limb/macro/src/tags/core/template.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/template.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/core/template.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -11,6 +11,7 @@
/**
* @tag template
+ * @req_attributes name
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/core/wrap.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/wrap.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/core/wrap.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -13,6 +13,7 @@
* class lmbMacroWrapTag.
*
* @tag wrap
+ * @req_attributes with
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/list/list.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/list/list.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/list/list.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,6 +12,7 @@
/**
* The parent compile time component for lists
* @tag list
+ * @req_attributes using
* @package macro
* @version $Id$
*/
@@ -19,6 +20,14 @@
{
protected $counter_var_var;
protected $count_source = false;
+
+ function preParse($compiler)
+ {
+ if(!$this->has('using') && $this->has('for'))
+ $this->set('using', $this->get('for'));
+
+ return parent :: preParse($compiler);
+ }
function countSource()
{
@@ -109,8 +118,7 @@
protected function _prepareSourceVar($code)
{
- if(!$using = $this->get('for'))
- $using = $this->get('using');
+ $using = $this->get('using');
$this->source_var = $code->generateVar();
$item_var = $code->generateVar();
Modified: 3.x/trunk/limb/macro/src/tags/list/list_empty.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/list/list_empty.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/list/list_empty.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,6 +12,7 @@
/**
* Empty List tag for a list which failed to have any contents
* @tag list:empty
+ * @parent_tag_class lmbMacroListTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/list/list_even.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/list/list_even.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/list/list_even.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,6 +12,7 @@
/**
* Renders a portion of the template if the current list row is even
* @tag list:even
+ * @parent_tag_class lmbMacroListItemTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/list/list_fill.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/list/list_fill.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/list/list_fill.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,7 +12,9 @@
/**
* Compile time component for output finalizers in a list
* Allows to generate valid layout while output multicolumn lists
- * Default ratio attribute is 1 * @tag list:fill
+ * Default ratio attribute is 1
+ * @tag list:fill
+ * @parent_tag_class lmbMacroListTag
* @package macro
* @version $Id$
*/
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 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/list/list_glue.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,6 +12,7 @@
/**
* Compile time component for separators in a list
* @tag list:glue
+ * @parent_tag_class lmbMacroListItemTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/list/list_item.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/list/list_item.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/list/list_item.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,6 +12,7 @@
/**
* Compile time component for items (rows) in the list
* @tag list:item
+ * @parent_tag_class lmbMacroListTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/list/list_odd.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/list/list_odd.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/list/list_odd.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,6 +12,7 @@
/**
* Renders a portion of the template if the current list row is odd
* @tag list:odd
+ * @parent_tag_class lmbMacroListItemTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/current.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/current.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/current.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:current
+ * @parent_tag_class lmbMacroPagerListTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/elipses.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/elipses.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/elipses.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,6 +12,8 @@
* Elipses are sed to mark omitted page numbers outside of the
* current range of the pager e.g. ...6 7 8... (the ... are the elipses)
* @tag pager:elipses
+ * @restrict_self_nesting
+ * @parent_tag_class lmbMacroPagerListTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/first.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/first.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/first.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:first
+ * @parent_tag_class lmbMacroPagerTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/first_disabled.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/first_disabled.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/first_disabled.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:first:disabled
+ * @parent_tag_class lmbMacroPagerTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/last.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/last.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/last.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -12,7 +12,7 @@
* @restrict_self_nesting
* @parent_tag_class lmbMacroPagerTag
* @package macro
- * @version $Id: last.tag.php 6386 2007-10-05 14:22:21Z serega $
+ * @version $Id$
*/
class lmbMacroPagerLastTag extends lmbMacroTag
{
Modified: 3.x/trunk/limb/macro/src/tags/pager/last_disabled.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/last_disabled.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/last_disabled.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:last:disabled
+ * @parent_tag_class lmbMacroPagerTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/next.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/next.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/next.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:next
+ * @parent_tag_class lmbMacroPagerTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/next_disabled.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/next_disabled.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/next_disabled.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:next:disabled
+ * @parent_tag_class lmbMacroPagerTag
+ * @restrict_self_nesting
* @version $Id$
*/
class lmbMacroPagerNextDisabledTag extends lmbMacroTag
Modified: 3.x/trunk/limb/macro/src/tags/pager/number.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/number.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/number.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:number
+ * @parent_tag_class lmbMacroPagerListTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/paginate.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/paginate.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/paginate.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -10,6 +10,7 @@
/**
* Applies pager to iterator (so called "pagination")
* @tag paginate
+ * @req_attributes iterator
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/prev.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/prev.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/prev.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:prev
+ * @parent_tag_class lmbMacroPagerTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/prev_disabled.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/prev_disabled.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/prev_disabled.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:prev:disabled
+ * @parent_tag_class lmbMacroPagerTag
+ * @restrict_self_nesting
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/section.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/section.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/section.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:section
+ * @restrict_self_nesting
+ * @parent_tag_class lmbMacroPagerListTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/src/tags/pager/separator.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/separator.tag.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/src/tags/pager/separator.tag.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -9,6 +9,8 @@
/**
* @tag pager:separator
+ * @restrict_self_nesting
+ * @parent_tag_class lmbMacroPagerListTag
* @package macro
* @version $Id$
*/
Modified: 3.x/trunk/limb/macro/tests/cases/lmbMacroFilterDictionaryTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/lmbMacroFilterDictionaryTest.class.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/tests/cases/lmbMacroFilterDictionaryTest.class.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -22,26 +22,25 @@
function testFindFilterInfo()
{
- $filter_info = new lmbMacroFilterInfo('testtag', 'SomeFilterClass');
+ $filter_info = new lmbMacroFilterInfo('testfilter', 'SomeFilterClass');
$dictionary = new lmbMacroFilterDictionary();
$dictionary->register($filter_info, $file = 'whatever');
- $this->assertIsA($dictionary->findFilterInfo('testtag'), 'lmbMacroFilterInfo');
+ $this->assertIsA($dictionary->findFilterInfo('testfilter'), 'lmbMacroFilterInfo');
}
function testFindFilterInfoByAlias()
{
- $filter_info = new lmbMacroFilterInfo('testtag', 'SomeFilterClass');
- $filter_info->setAliases(array('testtag_alias', 'testtag_alias2'));
+ $filter_info = new lmbMacroFilterInfo('testfilter', 'SomeFilterClass');
+ $filter_info->setAliases(array('testfilter_alias', 'testfilter_alias2'));
$dictionary = new lmbMacroFilterDictionary();
$dictionary->register($filter_info, $file = 'whatever');
- $this->assertIsA($dictionary->findFilterInfo('testtag'), 'lmbMacroFilterInfo');
- $this->assertIsA($dictionary->findFilterInfo('testtag_alias'), 'lmbMacroFilterInfo');
- $this->assertIsA($dictionary->findFilterInfo('testtag_alias2'), 'lmbMacroFilterInfo');
+ $this->assertIsA($dictionary->findFilterInfo('testfilter'), 'lmbMacroFilterInfo');
+ $this->assertIsA($dictionary->findFilterInfo('testfilter_alias'), 'lmbMacroFilterInfo');
+ $this->assertIsA($dictionary->findFilterInfo('testfilter_alias2'), 'lmbMacroFilterInfo');
}
-
function testRegisterFilterInfoOnceOnly()
{
$dictionary = new lmbMacroFilterDictionary();
@@ -55,7 +54,7 @@
function testFilterNotFound()
{
- $filter_info = new lmbMacroFilterInfo('testtag', 'SomeFilterClass');
+ $filter_info = new lmbMacroFilterInfo('testfilter', 'SomeFilterClass');
$dictionary = new lmbMacroFilterDictionary();
$dictionary->register($filter_info, $file = 'whatever');
Modified: 3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php 2007-11-18 21:21:06 UTC (rev 6526)
+++ 3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php 2007-11-19 07:45:09 UTC (rev 6527)
@@ -24,11 +24,23 @@
function testFindTagInfo()
{
- $tag_info = new lmbMacroTagInfo('testtag', 'SomeTagClass');
+ $tag_info = new lmbMacroTagInfo('test_tag', 'SomeTagClass');
$dictionary = new lmbMacroTagDictionary();
$dictionary->register($tag_info, $file = 'whatever');
+ $this->assertIsA($dictionary->findTagInfo('test_tag'), 'lmbMacroTagInfo');
+ }
+
+ function testFindFilterInfoByAlias()
+ {
+ $tag_info = new lmbMacroTagInfo('testtag', 'SomeFilterClass');
+ $tag_info->setAliases(array('testtag_alias', 'testtag_alias2'));
+ $dictionary = new lmbMacroTagDictionary();
+ $dictionary->register($tag_info, $file = 'whatever');
+
$this->assertIsA($dictionary->findTagInfo('testtag'), 'lmbMacroTagInfo');
+ $this->assertIsA($dictionary->findTagInfo('testtag_alias'), 'lmbMacroTagInfo');
+ $this->assertIsA($dictionary->findTagInfo('testtag_alias2'), 'lmbMacroTagInfo');
}
function testRegisterTagInfoOnceOnly()
@@ -58,6 +70,10 @@
<?php
/**
* @tag foo_{$rnd}
+ * @req_attributes attr1, attr2
+ * @restrict_self_nesting
+ * @parent_tag_class SomeParentTagClass
+ * @forbid_end_tag
*/
class Foo{$rnd}Tag extends lmbMacroTag{}
@@ -70,6 +86,11 @@
$tag_info1 = new lmbMacroTagInfo("foo_$rnd", "Foo{$rnd}Tag");
$tag_info1->setFile($file);
+ $tag_info1->setForbidEndtag(true);
+ $tag_info1->setRestrictSelfNesting(true);
+ $tag_info1->setParentClass('SomeParentTagClass');
+ $tag_info1->setRequiredAttributes(array('attr1', 'attr2'));
+
$tag_info2 = new lmbMacroTagInfo("bar_$rnd", "Bar{$rnd}Tag");
$tag_info2->setFile($file);
More information about the limb-svn
mailing list