[limb-svn] r6303 - 3.x/trunk/limb/macro/src/tags
svn at limb-project.com
svn at limb-project.com
Fri Sep 14 22:22:19 MSD 2007
Author: pachanga
Date: 2007-09-14 22:22:19 +0400 (Fri, 14 Sep 2007)
New Revision: 6303
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6303
Modified:
3.x/trunk/limb/macro/src/tags/into.tag.php
3.x/trunk/limb/macro/src/tags/wrap.tag.php
Log:
-- multi wrap support added
Modified: 3.x/trunk/limb/macro/src/tags/into.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/into.tag.php 2007-09-14 15:23:56 UTC (rev 6302)
+++ 3.x/trunk/limb/macro/src/tags/into.tag.php 2007-09-14 18:22:19 UTC (rev 6303)
@@ -22,5 +22,38 @@
*/
class lmbMacroIntoTag extends lmbMacroTag
{
+ function preParse($compiler)
+ {
+ parent :: preParse($compiler);
+
+ $tree_builder = $compiler->getTreeBuilder();
+ $this->_insert($this->parent, $tree_builder, $this->get('slot'));
+ }
+
+ function _insert($wrapper, $tree_builder, $point)
+ {
+ $this->_insertOrReplace($wrapper, $tree_builder, $point, $replace = false);
+ }
+
+ protected function _insertOrReplace($wrapper, $tree_builder, $point, $replace = false)
+ {
+ $insertionPoint = $wrapper->findChild($point);
+ if(empty($insertionPoint))
+ {
+ $params = array('slot' => $point);
+ if($wrapper !== $this)
+ {
+ $params['parent_wrap_tag_file'] = $wrapper->getTemplateFile();
+ $params['parent_wrap_tag_line'] = $wrapper->getTemplateLine();
+ }
+
+ $this->raise('Wrap slot not found', $params);
+ }
+
+ if($replace)
+ $insertionPoint->removeChildren();
+
+ $tree_builder->pushCursor($insertionPoint, $this->location);
+ }
}
Modified: 3.x/trunk/limb/macro/src/tags/wrap.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/wrap.tag.php 2007-09-14 15:23:56 UTC (rev 6302)
+++ 3.x/trunk/limb/macro/src/tags/wrap.tag.php 2007-09-14 18:22:19 UTC (rev 6303)
@@ -31,27 +31,11 @@
$file = $this->get('with');
$this->_compileSourceFileName($file, $compiler);
- if($includes = $this->_collectIncludes())
- {
- foreach($includes as $include)
- {
- $this->_insert($include, $tree_builder, $include->get('slot'));
- }
- }
- else
- $this->_insert($this, $tree_builder, $this->get('into'));
+ //if there's no 'into' attribute we consider that <%into%> tags used instead
+ if($into = $this->get('into'))
+ $this->_insert($this, $tree_builder, $into);
}
- protected function _isMultiWrap()
- {
- return sizeof($this->_collectIncludes()) !== 0;
- }
-
- protected function _collectIncludes()
- {
- return $this->findImmediateChildrenByClass('lmbMacroIntoTag');
- }
-
protected function _compileSourceFileName($file, $compiler)
{
$this->sourcefile = $compiler->getTemplateLocator()->locateSourceTemplate($file);
More information about the limb-svn
mailing list