Re: [xwiki-users] Macros in XWiki.org dev guide

2008-02-01 Thread Ludovic Dubost

At this point, #includeMacros is the way to go.
We would need to see how to have velocity load wiki pages declared in 
the preferences as global Macros. But this is not yet available in XWiki.

One trick which has some  (very slight ) performance cost is to add your 
macros in your skin. This way they are always available.

Ludovic

Paul Grodt wrote:
>
> That's exactly what I wanted to know, thank you!  Now I wonder if
> there's some way to get the best of both worlds.  Users without disk
> access cannot edit the macros.vm file, and it's a pain to have to
> include the code segments every time you want to use itJust musing
> but there must be a way to write a generic call that fetches a segment
> from a specified object (or page, whatever) on xwiki and then calls the
> contained macro using a variable number of arguments (and only pulls in
> the code once per page).
>
> But yes, that's what I needed to know to get started, thanks again.
>
> -Paul Grodt
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
>   


-- 
Ludovic Dubost
Blog: http://blog.ludovic.org/
XWiki: http://www.xwiki.com
Skype: ldubost GTalk: ldubost

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Macros in XWiki.org dev guide

2008-01-31 Thread Jerome Velociter
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf
>> Of Jerome Velociter
>> Sent: Wednesday, January 30, 2008 3:37 PM
>> To: XWiki Users
>> Subject: Re: [xwiki-users] Macros in XWiki.org dev guide
>>
>> 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#velocimacros
>> (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.
>
> That's exactly what I wanted to know, thank you!  Now I wonder if
> there's some way to get the best of both worlds.  Users without disk
> access cannot edit the macros.vm file, and it's a pain to have to
> include the code segments every time you want to use itJust musing
> but there must be a way to write a generic call that fetches a segment
> from a specified object (or page, whatever) on xwiki and then calls the
> contained macro using a variable number of arguments (and only pulls in
> the code once per page).

What I can think of now is having your skin as XWikiDocument (possibly
extending one you have on filesystem). There might be ways to parse
content from a document from within the macros.vm file, so that you have
macros available everywhere, and stored in wiki pages... Not sure how,
must be experimented I guess.

Jerome.

>
> But yes, that's what I needed to know to get started, thanks again.
>
> -Paul Grodt
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>


___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Macros in XWiki.org dev guide

2008-01-30 Thread Paul Grodt
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
> Of Jerome Velociter
> Sent: Wednesday, January 30, 2008 3:37 PM
> To: XWiki Users
> Subject: Re: [xwiki-users] Macros in XWiki.org dev guide
> 
> 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#velocimacros
> (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.

That's exactly what I wanted to know, thank you!  Now I wonder if
there's some way to get the best of both worlds.  Users without disk
access cannot edit the macros.vm file, and it's a pain to have to
include the code segments every time you want to use itJust musing
but there must be a way to write a generic call that fetches a segment
from a specified object (or page, whatever) on xwiki and then calls the
contained macro using a variable number of arguments (and only pulls in
the code once per page).

But yes, that's what I needed to know to get started, thanks again.

-Paul Grodt
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Macros in XWiki.org dev guide

2008-01-30 Thread Jerome Velociter
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#velocimacros
(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@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>


___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Macros in XWiki.org dev guide

2008-01-30 Thread Paul Grodt
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?

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@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users