Hi Nathan, I thought that might be the case although I rather like the idea of the quiet notation idea. Is it possible to create a custom directive that subclasses macro called "!macro" or will the parser/lexer not find these?
Thanks Steve -----Original Message----- From: Nathan Bubna [mailto:[email protected]] Sent: 14 September 2010 15:46 To: Velocity Users List Subject: Re: Check to see if macro defined You'd have to hack Velocity to do it cleanly. There's currently no way to test that in the template. RuntimeInstance has an isVelocimacro(name, templateName) method, but it is not even exposed in VelocityEngine, much less in the template. On Tue, Sep 14, 2010 at 5:12 AM, Steve O'Hara <[email protected]> wrote: > We have a number of macro libraries that are used across projects. > We need to change some of the 'general' macros so that they will > optionally make a call to a 'project' macro if it exists. > For example; > > #macro(outputLabel $Field) > #set ($Label=$Field.getLabel()) > #if (#projectOutputLabel is Defined) > #projectOutputLabel($Field) > #end > $Label > #end > > May be not a very good example but you get the idea. Perhaps a way to > implement it if there isn't a way already would be to enable the quiet > syntax using the exclamation mark e.g. > > #macro(outputLabel $Field) > #set ($Label=$Field.getLabel()) > #!projectOutputLabel($Field) > $Label > #end > > Any ideas? > > Thanks, > > Steve > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
