I went back and pulled the velocity source to the revision (471881)
before the changes to bug 285 and found that the behavior is as
expected, so I conclude this is a bug :) which has been created here:
https://issues.apache.org/jira/browse/VELOCITY-630
On Oct 10, 2008, at 17:04 , Byron Foster wrote:
Given the following:
#macro(test $a $b)
#foreach($i in $a) $b #end
#end
#test( [1, 2, 3] "#if($i == 2) yes #else no #end")
I would expect the output:
no yes no
Instead, I get
no no no
However, if I have
#macro(test $a $b)
#set($i = 1) $b #set($i = 2) $b #set($i = 3) $b
#end
#test( [1, 2, 3] "#if($i == 2) yes #else no #end")
then I get:
no yes no
as expected.
I would say there is a bug here. The Foreach directive explicitly
sets $i in the localscope. If I replace the explicit put to the
localscope with a regular put, the first macro case works. I was
looking at the following issues where the modification to Foreach
was mode.
https://issues.apache.org/jira/browse/VELOCITY-285
Now, my test change to Foreach breaks issue 285, but I'm not
convinced that the resolution to 285 is complete. Thoughts?
---------------------------------------------------------------------
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]