Re: More 1.7 BC issues (porting from 1.5)

Boris Partensky <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <CABsrNP9ieeqVL0EEwa9xDvBdZdpQA=BGXm_WTZAEKzHQi+71uA@mail.gmail.com>
Not seeing any errors in log. Corrected to 2 single quotes. Same
behavior. I was hoping that $input in each iteration will not be empty
string, but rather 'foo', 'bar' etc (that's the way 1.5 behaves). Why
would setting a value of $type in parent (foreach) scope would affect
the value of the local $input argument?

String template = "#set($global_types=['foo', 'bar', 'yok',
'dar'])#macro( showBox $input)#set($type = '')$input#end"+
                "#macro(showBoxes $types)#foreach($type in
$types)#showBox($type)#end#end#showBoxes($global_types)";


On Thu, May 3, 2012 at 2:33 PM, Nathan Bubna <[email protected]> wrote:
> Anything in the log?  #set($type = \"\") is not valid syntax, i think.
>  I'm not even sure what value you want $type to have.  Two double
> quotes or an empty string?
>
> On Thu, May 3, 2012 at 11:17 AM, Boris Partensky
> <[email protected]> wrote:
>> Hi, I have this use case which involves 2 nested macros and a foreach.
>> I am trying to understand why this template evaluates to empty string
>> on 1.7, and to "foobaryokdar" - on 1.5.
>>
>>
>> String template = "#set($global_types=['foo', 'bar', 'yok',
>> 'dar'])#macro( showBox $input)#set($type = \"\")$input#end"+
>>                "#macro(showBoxes $types)#foreach($type in
>> $types)#showBox($type)#end#end#showBoxes($global_types)";
>>
>> ---------------------------------------------------------------------
>> 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]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.