Re: Overriding a macro definition

Christopher Schultz <[email protected]> Mon, 20 Jun 2022 13:54:02 -0400
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
All,

On 6/20/22 13:40, Christopher Schultz wrote:
> I have a process where I'd like to use a global macro library but also 
> allow the individual templates to override the macros if necessary.
> 
> My code looks something like this:
> 
> 
> // == One-time setup
> Properties props = new Properties();
> props.setProperty("velocimacro.inline.allow", "true");
> props.setProperty("velocimacro.inline.local_scope", "true");

/facepalm

I'm not sure how I messed-up the copy/paste of those settings, but they 
should have been:

props.setProperty("velocimacro.permissions.allow.inline", "true");
props.setProperty("velocimacro.permissions.allow.inline.local.scope", 
"true");

It's working as expected, now.

As a follow-up question: is it possible to call the "global" macro after 
it's been shadowed? Alternatively, is it possible to copy a macro to a 
different name before shadowing it?

I'm using Velocity 1.7 if that's particularly important.

Thanks,
-chris