+1 for the general principal of using rendering api from script in place of velocity macros. I would prefer a MacroClass which can support any script language. Thanks to jsr223, the only difference with what you described is that the macro content would be executed with a different engine depending on a "language" field of the MacroClass (and the name of the class would be different ;)). This field would be to "velocity" by default I guess. On Wed, Feb 4, 2009 at 8:41 AM, Vincent Massol <[email protected]> wrote:
Hi,
We need to allow users to write macros using Velocity and still use the same mechanism as the new rendering. Basically this means transforming velocity macros into Rendering Macros. Once this is done then the velocity macro will be able to be used as standard Rendering Macros, they'll appear in the new WYSIWYG, etc.
Here's a proposal for doing so:
* Split xwiki-velocity/ module into 2 - xwiki-velocity-engine/ (the one currently in xwiki-velocity) - xwiki-velocity-macro/ (the new one) * In xwiki-velocity-macro create a VelocityMacroManager class that does the following: - initialize itself at xwiki startup - create a VelocityMacroClass definition in the wiki if it doesn't exist - query the wiki for all objects of type VelocityMacroClass - for each of them register them dynamically (we can already do this) as a Rendering Macro * The VelocityMacroClass has several fields: - macro name, parameter names, parameters description, macro description, usage example, velocity content to execute (the macro content) * The VelocityMacroManager register itself against the Observation component to receive notifications whenever a VelocityMacroClass is modified (added, removed, etc) * Users will then be able to add velocity macros by simply creating a new page, adding the VelocityMacroClass in it, fill the values. * We should also provide a VelocityMacroClassSheet so that the macro page containing the VelocityMacroClass can display the help for the macro (self-standing)
The nice thing is that this keeps velocity macro handling in the xwiki- velocity/ module and makes it completely optional (i.e. the wiki will still work and there's no ties with this feature elsewhere).
WDYT?
Thanks -Vincent http://xwiki.com http://xwiki.org http://massol.net
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne