<
From version < 73.5 >
edited by StefanBachert
on 2010/02/26
To version < 74.1 >
edited by Thomas Mortagne
on 2010/05/12
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.StefanBachert
1 +XWiki.ThomasMortagne
Content
... ... @@ -109,6 +109,27 @@
109 109  
110 110  * Access [MacroTransformationContext>http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/transformation/MacroTransformationContext.java]: Use the context object (Ex. $context.macro.context)
111 111  
112 +* It's possible to directly return the desired list of rendering Blocks without having to render them first to let them be parsed back by the macro transformation. The benefits are that it could be a lots quicker and most of all it means supporting syntax which does not provide any renderer. It also make possible to generate some XDOM which is impossible to write in any some syntax. For example the following wiki macro is generating a LinkBlock targeting a relative URL:
113 +
114 +{code}
115 +{{groovy}}
116 +
117 +import java.util.Collections;
118 +import org.xwiki.rendering.listener.Link;
119 +import org.xwiki.rendering.block.WordBlock;
120 +import org.xwiki.rendering.block.LinkBlock;
121 +
122 +ref link = new Link();
123 +link.setReference("/xwiki/edit/Main/WebHome");
124 +link.setType(LinkType.URI);
125 +
126 +ref linkBlock = new LinkBlock(Collections.singletonList(new WordBlock("Edit home page"))), link, false);
127 +
128 +xcontext.macro.result = Collections.singletonList(linkBlock)
129 +{{/groovy}}
130 +
131 +This text will not appear in the result.
132 +{code}
112 112  1.1 Troubleshooting
113 113  
114 114  1.1.1 A Pitfall of Optional Parameters

Get Connected