[xwiki-devs] Inject Parameter in a macro in a other document
Hi, i want to display some pages in one page (to create a print or pdf). I use {{groovy}} import org.xwiki.rendering.lyrics.Lyrics; for (Lyrics lyrics: services.component.getComponentManager().getInstanceList(Lyrics.class)) { // println("{{html}}\n\n{{/html}}\n") println("== "+lyrics.getTitle()+"==") println("{{include reference=\""+lyrics.getDocument()+"\"/}}") } {{/groovy}} with the Lyrics Macro (http://extensions.xwiki.org/xwiki/bin/view/Extension/Lyrics). But now i need to change some parameters in the macro from the included pages, so i can change the layout. I looked into the code of the include macro and try to set some parameters in the macro-block from the //documentBridge//. But this is after testing not working. Could you give me a hint? Goal: I want to add a playlist-feature to the lyrics-macro, so i can set some songs which could be displayed in one page. For print i want to add the feature to enable/disable the fret-chord-pictures. Regards, Matthias -- View this message in context: http://xwiki.475771.n2.nabble.com/Inject-Parameter-in-a-macro-in-a-other-doc... Sent from the XWiki- Dev mailing list archive at Nabble.com.
On Sun, Dec 8, 2013 at 10:14 PM, Matthias Wegner <[email protected]> wrote:
Hi,
i want to display some pages in one page (to create a print or pdf). I use
{{groovy}} import org.xwiki.rendering.lyrics.Lyrics; for (Lyrics lyrics: services.component.getComponentManager().getInstanceList(Lyrics.class)) { // println("{{html}}\n\n{{/html}}\n") println("== "+lyrics.getTitle()+"==")
You could output a Velocity macro here where you set the parameters: println("{{velocity}}#set($parameter = 'value'){{/velocity}}")
println("{{include reference=\""+lyrics.getDocument()+"\"/}}") } {{/groovy}}
Hope this helps, Marius
with the Lyrics Macro (http://extensions.xwiki.org/xwiki/bin/view/Extension/Lyrics). But now i need to change some parameters in the macro from the included pages, so i can change the layout. I looked into the code of the include macro and try to set some parameters in the macro-block from the //documentBridge//. But this is after testing not working. Could you give me a hint?
Goal: I want to add a playlist-feature to the lyrics-macro, so i can set some songs which could be displayed in one page. For print i want to add the feature to enable/disable the fret-chord-pictures.
Regards, Matthias
-- View this message in context: http://xwiki.475771.n2.nabble.com/Inject-Parameter-in-a-macro-in-a-other-doc... Sent from the XWiki- Dev mailing list archive at Nabble.com. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Marius, this is not what i mean. I want to change the content or the Parameter of a macro in java. I want to load / DocumentModelBridge documentBridge = this.documentAccessBridge.getDocument(includedReference);/ and then use / Block block = documentBridge.getXDOM().getRoot().getFirstBlock(new MacroBlockMatcher("customMacro"), Block.Axes.DESCENDANT); block.getParent().replaceChild() to change the content of the macro. / After that i want to render it with / result = this.documentDisplayer.display(documentBridge, displayParameters);/ This code-snippets are from the java-include-macro and i want to change some macro-code of the included document for displaying them different. My problem is that i tried some different methods to overwrite the loaded macro content, but nothing works. Did you use somewhere a kind of that function? Regards, Matthias -- View this message in context: http://xwiki.475771.n2.nabble.com/Inject-Parameter-in-a-macro-from-an-other-... Sent from the XWiki- Dev mailing list archive at Nabble.com.
participants (2)
-
Marius Dumitru Florea -
Matthias Wegner