Hi everyone,
Many of our UI extension points use a code like this to render their extensions in a specified output syntax:
#foreach($uix in $services.uix.getExtensions('org.xwiki.platform.attachment.actions'))
$services.rendering.render($uix.execute(), 'html/5.0')
#end
We sometimes pass “xhtml/1.0” as output syntax, but the principle is the same. The problem with this is that the UI extension is actually executed without taking into account the specified output syntax (‘html/5.0’ or ‘xhtml/1.0’). We execute it first, using the output/target syntax from the rendering context, which is influenced by the outputSyntax request parameter, and then we render it to the specified output syntax. This means that a template-based or wiki-based UI extension that produces a RawBlock will have no output when rendered on a page with ?outputSyntax=plain in the URL. This causes Loading... , because the PDF sheet is loaded with outputSyntax=plain and the sheet renders htmlheader.vm / meta.vm which execute org.xwiki.platform.html.head UI extensions. These UI extensions produce no output on PDF export.
Possible solutions:
- quick fix: each UI extension that is in this case can specify
##!raw.syntax=html/5.0in its template - better fix: introduce a new API to execute + render a UI extension to a specified output syntax, something like
$services.uix.render($uix, 'html/5.0')
WDYT?
Thanks,
Marius