From caveden@gmail.com Fri May 30 16:57:12 2008 From: Tiago Rinck Caveden To: xwiki-users@xwiki.org Subject: [xwiki-users] Image macro inside a recursive macro doesn't work for the first call Date: Fri, 30 May 2008 16:57:01 +0200 Message-ID: <1959b7510805300757n5bb3952bkd47821b418acb218@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3257529537735722906==" --===============3257529537735722906== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello, I have a recursive velocity macro that calls the Image macro provided by XWiki. Weirdly, the call doesn't work only for the first call of this recursive function. All the subsequent ones (the really "recursive" calls) render the image perfectly. For the first call what's rendered is the code that calls the image macro, with the brackets and everything, as if I had escaped it somehow. Does anyway has any idea of what is happening? Maybe it helps if you can see the code, so here it goes. The calls to my macro and to the image macro are in bold: #macro (createChildrenNodes $parentNodeName $childrenSkillList) #foreach ($skill in $childrenSkillList) #set ($iconStyleClass =3D "ygtv") #if($velocityCount =3D=3D $childrenSkillList.size()) #set($iconStyleClass =3D $iconStyleClass + "l") #else #set($iconStyleClass =3D $iconStyleClass + "t") #end #if ($skill.hasChildren) #set($iconStyleClass =3D $iconStyleClass + "p") #else #set($iconStyleClass =3D $iconStyleClass + "n") #end var node$skill.id =3D new YAHOO.widget.HTMLNode('
$skill.name  *{image:sup= primer.bmp|13|alt=3DClick to delete skill $skill.name}*
', $parentNodeName, true); *#createChildrenNodes("node$skill.id" $skill.children)* #end #end function treeInit() { var tree =3D new YAHOO.widget.TreeView("treeview"); var root =3D tree.getRoot(); *#createChildrenNodes('root' $xwiki.cartography.getSkillTree())* tree.draw(); } treeInit(); Thanks, --=20 Tiago Rinck Caveden http://caveden.multiply.com --===============3257529537735722906==-- From caveden@gmail.com Fri May 30 17:08:24 2008 From: Tiago Rinck Caveden To: xwiki-users@xwiki.org Subject: Re: [xwiki-users] Image macro inside a recursive macro doesn't work for the first call Date: Fri, 30 May 2008 17:08:14 +0200 Message-ID: <1959b7510805300808i35d7f038p178df9f6b41029db@mail.gmail.com> In-Reply-To: <1959b7510805300757n5bb3952bkd47821b418acb218@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5326873766463639632==" --===============5326873766463639632== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I forgot to mention that the problem is in the first call of the image macro inside my macro only. I tried calling the image macro before and after the call to my recursive macro, and in both cases it worked without any problems. On Fri, May 30, 2008 at 4:57 PM, Tiago Rinck Caveden wrote: > Hello, > > I have a recursive velocity macro that calls the Image macro provided by > XWiki. Weirdly, the call doesn't work only for the first call of this > recursive function. All the subsequent ones (the really "recursive" calls) > render the image perfectly. For the first call what's rendered is the code > that calls the image macro, with the brackets and everything, as if I had > escaped it somehow. > > Does anyway has any idea of what is happening? > > Maybe it helps if you can see the code, so here it goes. The calls to my > macro and to the image macro are in bold: > > #macro (createChildrenNodes $parentNodeName $childrenSkillList) > #foreach ($skill in $childrenSkillList) > > #set ($iconStyleClass =3D "ygtv") > #if($velocityCount =3D=3D $childrenSkillList.size()) > #set($iconStyleClass =3D $iconStyleClass + "l") > #else > #set($iconStyleClass =3D $iconStyleClass + "t") > #end > #if ($skill.hasChildren) > #set($iconStyleClass =3D $iconStyleClass + "p") > #else > #set($iconStyleClass =3D $iconStyleClass + "n") > #end > > var node$skill.id =3D new YAHOO.widget.HTMLNode(' cellpadding=3D0 cellspacing=3D0>
class=3D"$iconStyleClass">
skill.id">$skill.name   href=3D"./DefiningExistentSkills?do=3Ddelete&skillId=3D$skill.id">*{image:s= upprimer.bmp|13|alt=3DClick > to delete skill $skill.name}*
', $parentNodeName, > true); > *#createChildrenNodes("node$skill.id" $skill.children)* > > #end > #end > > function treeInit() > { > var tree =3D new YAHOO.widget.TreeView("treeview"); > var root =3D tree.getRoot(); > *#createChildrenNodes('root' $xwiki.cartography.getSkillTree())* > tree.draw(); > } > treeInit(); > > > Thanks, > -- > Tiago Rinck Caveden > http://caveden.multiply.com --=20 Tiago Rinck Caveden http://caveden.multiply.com --===============5326873766463639632==--