You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Akshay Kapur <ak...@cisco.com> on 2003/04/02 01:15:16 UTC
Macros defined Inline and #parse
Hello
There is a scenario wherein a parent.vm #parses a child.vm(which contains a
macro definition and it's invocation). The config property
velocimacro.permissions.allow.inline.local.scope is set to false. The
child.vm is parsed properly and the macro correctly executes too.
However, when I set this property to true, the macro doesn't get invoked.
Now I have read the Velocity users guide which explains that macros are
loaded into memory at compile time and since #parse command is executed at
run-time, the macros defined inline in a #parsed file don't get loaded at all.
My question is why does switching the above mentioned config property to
false make the whole thing work??!! Why do the inline macros get loaded in
the first place when the rules for compile-time/ run-time should be the
same irrespective of the switch?
Thanks
Akshay
--Structure of the above mentioned files is depicted below --
parent.vm
...
#parse( "child.vm" )
...
<< EOF >>
*******************
child.vm
...
#macro ( print )
..I was defined in included file!!!
#end
...
#print()
<< EOF >>