Great work, Supun!  The code and tests look great.  I look forward to
trying this out myself.

On 8/22/07, Supun Kamburugamuva <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> I'm really glad that I could solve both VELOCITY-362 and VELOCITY-529.
> Here is a general description about how I solved the two problems.
>
> These two problems are interrelated and solving one gives the chance
> to solve the other as well. For example if we can specify that a set
> of macro files must be used for a particular rendering of a template
> (VELOCITY-529) that same underlying mechanism can be used for
> specifying that #parse files must be used for the rendering of a
> template.
>
> As I have mentioned previously in a mail, the problem with the #parse
> and macros was that parse files are built (building AST) and rendered
> at the render time of the template.  Macro call is considered valid if
> it already has an implementation (it has to be registered). So the
> problem was that macros are defined in #parse files which are built
> after the files which contain the macro calls were built. So the macro
> calls got invalidated and considered as text.
>
> In my approach I don't invalidate macros at the parsing time and let
> that happen at the render time.  So a macro call without a macro
> implementation won't get invalidated. I have done few changes to the
> parser to support this.
>
> When we see a macro call instead of requesting for a VelocimacroProxy
> object I'm creating a RuntimeMacro object. I have added few methods to
> the InternalHouseKeepingContext to hold the macro libraries associated
> with a particular merge. When a template.merge happens with a macro
> libraries list the macro libraries (names) are added to the context.
> When the RuntimeMacro is rendered it checks for a Macro implementation
> in the Macrolibraries specified in the context. If it can find a
> VelocimacroProxy it initializes it and then renders it.
>
> VELOCITY-529
> Template.merge(context, writer, Macro Library List);
>
> VELOCITY-529
> #parse(macroLibrary.vm)
> ##use macros from the library
> #foo()
>
> I think this mail is getting too long. I have added couple of test
> cases as well.
>
> Regards,
> Supun.
>
> ---------------------------------------------------------------------
> 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]

Reply via email to