Hi devs,
I have this wiki syntax:
----------8<----------
{{velocity output="false"}}
$xwiki.ssrx.use('uicomponents/widgets/gallery.css')
$xwiki.jsrx.use('uicomponents/widgets/gallery.js')
{{/velocity}}
(% class="gallery" %)(((
image:first.png
...
image:last.png
)))
---------->8----------
and I'd like to make the resource import automatic. I think we can
achieve this in two steps.
(1) Add a way to group skin extensions. I'd like to be able to write this:
----------8<----------
{{velocity output="false"}}
$xwiki.gsx.use('gallery')
{{/velocity}}
(% class="gallery" %)(((
image:first.png
...
image:last.png
)))
---------->8----------
(2) Write a rendering transformation that looks for style names (CSS
classes) in the content and imports the skin extension group with the
same name. This way I'd be able to write just:
----------8<----------
(% class="gallery" %)(((
image:first.png
...
image:last.png
)))
---------->8----------
Let's consider the technical details now:
(1) I propose we add two XWiki classes:
XWiki.SkinExtension
* type (StaticList): jsrx
* resource (String): uicomponents/widgets/gallery.js
XWiki.SkinExtensionRole
* role (String): gallery
which will be used by a new SkinExtension plugin and component
(hint=gsx). The XWiki.SkinExtensionRole objects will be joined with
XWiki.SkinExtension objects by document id. In other words, in order to
create a skin extension group you have to add a XWiki.SkinExtensionRole
object and multiple XWiki.SkinExtension objects to a document.
To make group creation easier for StyleSheetExtension and
JavaScriptExtension the new skin extension plugin will include them
automatically in the group defined by the XWiki.SkinExtensionRole. In
other words if you want to group a JSX and a SSX that are on the same
document you just have to add a XWiki.SkinExtensionRole object to that
document.
(2) The rendering transformation that will automatically import the skin
extension groups based on style names will use the skin extension
component defined at step (1). This transformation should be the last
one executed.
WDYT? I'd like to implement this ASAP as it doesn't seem to be very
complicated.
Thanks,
Marius