Hello,
The dev guides do a fine job explaining the use of
groovy and velocity
code snippets. They also explain how to develop applications and
plugins by creating classes. However they don't do much to explain the
creation of macros; that or I'm failing to find this.
I greatly prefer using macros over copy/paste coding snippets into each
article. I managed to find this lovely article about creating Radeox
macros in xwiki:
http://hritcu.wordpress.com/2007/03/13/xwiki-plugins-tips-and-tricks/
but I'm struggling to find info on creating/adding what I believe are
referred to as Velocity Macros (#macroName(var1, var2...)). I assume
help has been requested on this repeatedly, but I seem to again be
having poor luck in my keyword searches. Looking at trends in macro
submissions, Velocity macros seem to be preferable in most cases, are
they? Does each have strengths and weaknesses?
You will find Velocity macros documentation in the apache velocity user
guide :
http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#vel…
(Agreed, did not found that link on first google shot ;))
Velocity macros are very usefull within XWiki. You can define those either
in the macros.vm file of your skin, or inside wiki pages. The first option
has the advantage of letting the macros defined be available for every
document of your wiki; but the file can grow quickly if you have a lot of
macros, so the second option is there, precisely for application-specific
macros.
Best practice for this second option is to have one or several documents
that contains your application macros, and include that document from the
page that will actually use them, with the #includeMacros statement ; for
example :
#includeMacros("MyAppCode.AppMacros")
A part from that, there is very little XWiki-specific to know to write
velocity macros within your wiki. You can access the full XWiki API inside
your macro as you would usually do when scripting velocity inside a wiki
document.
Hope this help, and we'd be very keen on you contributing your experience
with velocimacros for xwiki on the dev guide.
Regards,
Jerome.
I'd love to extend the online documentation, but
I'm still learning. So
without experience or guidance, much of what I'd write would be little
more than educated guesses.
Thanks,
Paul D. Grodt
Tecore Networks
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users