velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wgl...@forio.com>
Subject Re: Resending email: velocity macro #exit feature
Date Thu, 15 Jul 2004 18:30:15 GMT
Hi Jian,

There's no "return" or "exit" feature right now for macros.  You might
download the source and look into adding it, although it's not the simplest
thing.  You'd have to modify the definition of #macro and add a new
directive #exit.  (personally, I like #return as it's a little more
subroutine like).

WILL

----- Original Message ----- 
From: <chenjian@uvic.ca>
To: <velocity-user@jakarta.apache.org>
Sent: Thursday, July 15, 2004 11:20 AM
Subject: Resending email: velocity macro #exit feature


> Hi, All,
>
> This question is similar to the one for adding a #exit to velocity
> template, but, I think maybe more difficult to add this feature. Anyway,
> here is my problem.
>
> I am writing a macro and I want to do something like:
>
> ## check for a special case
> #if (false)
> #exit
> #end
>
> ## general cases, do processing
> ...
>
> Without the #exit feature in the macro, I have to do put all my general
> cases into a #else statement, which is a lot of indenting, since in the
> general cases, there are also lot of if else statements.
>
> Is it very easy to add the exit feature to velocity macro and could anyone
> let me know how to do it?
>
> Thanks a lot,
>
> Jian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message