Apologies for a delayed response on this thread. Was buried in
some work for
the past couple of weeks. Was able to spend some time on this past couple
ofdays. Here's what I have, I have a working version of the blockmacro as
discussed in this thread.Patch attached. Here's the trivial example,
#blockmacro(html $style)<html style="$style"> ${yield}</html>#end Block Macro
Result#html("color:red") <body>Raghu</body>#end In broad brush strokes, here's
what I did, - Modified the grammar to look for blockmacro and register just
like theregular macro would.- Created a new proxy for this and dealt with
creating this one for blockmacros. I am yet to finish up some things, - Making
yield variable configurable- want to make the proxy class interceptable (I need
this ability tointercept and manipulate content)- the default templatetests
doesn't seem to be comparing with the cmps. Isthere something I need to do
special to make this work. If I replace thecontent of any existing content with
garbage, the tests still pass. Wouldappreciate help in pointing me in the right
direction here.- refactor my current tests to be in alignment with other tests
within theproject and add more complex tests. Bumped in to a catch though, - If
the block macro is used before it is declared, I would have no idea ifthe macro
is a LINE one or a BLOCK one. Currently, I am defaulting to LINEwhich will make
template parsing fail. There are four alternatives, I canthink of, OPTION-1:
Put a 'do' after my parameters. #html("something") do#end
Of course, 'do' could be optional, if html is defined already. The bad
thingabout this is it introduces new language semantics into VTL OPTION-2:
Create a call semantic for blockmacros #callBlockMacro (html "something")#end
Again the callBlockMacro is optional, if you have defined html already.
OPTION-3:Forward declaration for block macros. #forwardBlock html#forwardLine
strong OPTION-4 (My preference): A configurable convention on prefix &
suffix(thank you, Conor, for the suggestion) Blockmacro.default.prefix = _
Recommendations, alternate suggestions, would be appreciated. Thanks, Raghu.
_________________________________________________________________
Shed those extra pounds with MSN and The Biggest Loser!
http://biggestloser.msn.com/---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]