I’m trying to use $services.render($content, "xwiki/2.1") to render content provided within an XWiki object. It appears that rendering XWiki syntax works ok but velocity macros don’t get executed. Is there a secret flag to use for this? I assume that this may need some programming rights.
Alternatively, is there another way to request velocity execution with some regular xwiki context from within velocity or within java?
I was about to accept that only wiki rendering would be done until… I observed that the $services.rendering.render($xdom, 'xhtml/1.0') also doesn’t even resolve internationalization macros.
Let me try to detail my use-case, and maybe there’s something I can do. It can all be done in Java for me too but I am missing an example (what’s done in the Getting Started of rendering seems to be for a use case detached for XWiki and, in particular, may be missing context).
I am trying to allow “configuration objects” of “providers” to contain a piece of code. All such occurrences should be rendered within a page (with the HTML of the page).
So it seemed that the normal thing would be to store in java the source of the pieces of code and use velocity to render them. Some rendering should depend on the languages at least, hopefully other objects can be put in the velocity context so that the custom script can read this.
I don’t know what " internationalization macros" are but if they are rendering macros then this is implemented as a Macro Transformation and since Transformations are not executed by $services.rendering.render, it’s normal.
It’s all good. I got convinced that using the Converter class is ok. It all appeared baked for the usage outside of XWiki so that I was reluctant to use this and expected to use “objects lying around that were already initialized”. It took me a while to test, but that’s because of me.
It does work very well and using this allows me to use the breadth of all thinkable XWiki-supported syntaxes which is cool.
Thanks.
paul