On Jan 27, 2011, at 12:59 PM, Marius Dumitru Florea wrote:

> On 01/27/2011 01:41 PM, Vincent Massol wrote:
>> 
>> On Jan 27, 2011, at 10:05 AM, Marius Dumitru Florea wrote:
>> 
>>> On 01/26/2011 08:16 PM, Vincent Massol wrote:
>>>> Hi Marius,
>>>> 
>>>> While this is technically interesting isn't this adding too much 
>>>> complexity for the gain it brings?
>>>> 
>>>> For ex:
>>>> * the transformation will run always on all pages for all content, thus 
>>>> adding some small performance lag
>>>> * it's a little bit too magical maybe
>>>> 
>>>> I feel your example doesn't clearly show the advantage:
>>>> * the grouping is saving 1 line of code in the example
>>>> * the automatic import is saving 4 lines at the expense of clarity
>>>> 
>>>> Personally I think i'd *much* prefer to hide all this behind a gallery 
>>>> macro:
>>>> 
>>>> {{gallery}}
>>>> image:first.png
>>>> ...
>>>> image:last.png
>>>> {{/gallery}}
>>>> 
>>>> That macro would automatically add the SSX/JSX + class, thus hiding all 
>>>> complexity and implementation details from users.
>>>> 
>>>> WDYT?
>>> 
>>> Indeed, this will do for my purpose (office presentation viewer). But,
>>> as Jerome said, sometimes using style names is more convenient.
>> 
>> Yes but in that case we allow it (as you've shown in your example below) 
>> even if not 100% convenient (it's not that bad) :)
>> 
> 
>> I think it's good to direct users to package more complex things into 
>> macros, especially since it's easy to package as a wiki macro. It has 
>> several advantages, one of them being that it makes the "snippet" reusable.
> 
> One issue we have is that wiki macros that import JS/CSS can't be used 
> inside velocity code.

what's the problem?

Thanks
-Vincent

> 
> Thanks,
> Marius
> 
>> 
>> Thanks
>> -Vincent
>> 
>>>> On Jan 24, 2011, at 5:08 PM, Marius Dumitru Florea wrote:
>>>> 
>>>>> 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
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to