Seems reasonable to me.
As an alternative, consider making a custom directive to implement the desired
behavior directly.
Here's some notes on how to do that. http://wiki.apache.org/jakarta-velocity/HackingVelocity
WILL
----- Original Message ----- From: "chenjian" <[EMAIL PROTECTED]>
To: <velocity-user@jakarta.apache.org>
Sent: Tuesday, December 28, 2004 5:15 PM
Subject: making variables local in velocity macros
Hi, All,
I am looking at the Velocity 1.4 source code to try to figure out a way to make variables in #macro local. I don't want to use the #local custom directive, as it is still a hassle to declare what variables are to be taken as local.
What I want is that #macro behaves like a normal method call in java. Anything declared inside is local.
So, the question I have is, can I modify the Macro.java to accomplish this?
I find the following block of code in Macro.java:
/** * render() doesn't do anything in the final output rendering. * There is no output from a #macro() directive. */ public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException { /* * do nothing : We never render. The VelocimacroProxy object does that */
return true; }
So, in the beginning of render(...), can I save a snap shot of all the variables in the context, and at the end of render, re-populate the context with that snap shot?
Thanks in advance for any help!
Jian
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]