Hi Supun,
I keep trying to write a long involved answer and getting interrupted.
Let's try again.
No, I don't think they are necessarily related. It seems fine to do
VELOCITY-529 first. (specifying one or more macro library files at merge
time).
I was originally thinking that the way to do this is to create a
MacroCartridge object similar to EventCartridge, with a method
attachToContext. It's a little awkward for the user, but this way ensures
that the macros are carried through the entire request.
Context context = new VelocityContext();
MacroCartridge macros = new MacroCartridge();
macros.addTemplate("macro_library1.vm");
macros.addTemplate("macro_library2.vm");
macros.attachToContext(context);
template = Velocity.getTemplate(templateFile);
Writer writer = new new OutputStreamWriter(outFileName);
template.merge(context, writer);
But now I'm thinking it might be simplest to overload Template.merge and
VelocityEngine.evaluate methods
Context context = new VelocityContext();
List macroFiles = new ArrayList();
macroFiles.add("macro_library1.vm");
macroFiles.add("macro_library2.vm");
template = Velocity.getTemplate(templateFile);
Writer writer = new new OutputStreamWriter(outFileName);
template.merge(context, writer, macroFiles);
I'd hate to do this for every merge option, but including macros seems
pretty fundamental.
The key thing is that the macros should be loaded via the resource loader,
which will ensure they get cached.
Comments from anyone else?
WILL
On 6/17/07, Supun Kamburugamuva <[EMAIL PROTECTED]> wrote:
Hi,
In the past few days I was looking into VELOCITY-529 and other issues
that you have mention. I would like to start with the VELOCITY-529.
But before doing this do I have to resolve VELOCITY-362?
Supun..
--
Forio Business Simulations
Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com