On Oct 3, 2008, at 12:18 PM, Sergiu Dumitriu
wrote:
Pascal Voitot wrote:
OK,
I don't have solved everything but I have found the origin of the
stackoverflow...
I coded a Recursive VelocityMacro and apparently variables inside
VM macro
are not local and it makes my recursion infinite!!!
Apparently, there is an option in velocity to make local macro
variables
have only a local scope. Do you see any problem about this?
Yes, I had my share of
pain with the fact that variables defined
inside
macros are global... I am +1 for making them local, but all the
macros
should be checked, since some of them might use this "feature".
Velocity Macros *are* local (i.e. we're using the local macro
configuration option from Velocity).
<property>
<name>velocimacro.permissions.allow.inline.local.scope</
name>
<value>true</value>
</property>
However for the include feature of XWiki Syntax 1.0 to work we have a
hack in the velocity module to allow macros to span more than 1
document.
This is not required for the XWiki Syntax 2.0 (AFAIR) but we need it
for the 1.0 syntax to continue working.
Vincent, this is not about macros, but about $variables used in
macros.
For example:
#macro(doSomething)
#set($a = 'b')
#end
#doSomething()
$a => prints b, $a is now a global variable outside the scope of the
macro.