On Fri, Mar 20, 2009 at 12:23, C. Chad Wallace
<[email protected]> wrote:
> At 9:38 PM on 19 Mar 2009, Clayton Scott wrote:
>> [% SET cap = 'capitalised' | upper %]
>> [% cap %]
>>
>> vs
>>
>> [% cap = 'capitalised' | upper %]
>> [% cap %]
>
> Confirmed here, too:
>
> cwall...@ws80:~[17:54]$ tpage
> [% SET cap = 'capitalised' | upper %]
> [% cap %]
>
> capitalised
> cwall...@ws80:~[09:20]$ tpage
> [% cap = 'capitalised' | upper %]
> [% cap %]
>
> CAPITALISED
> cwall...@ws80:~[09:20]$ perl -MTemplate -e 'print $Template::VERSION, "\n"'
> 2.19
>
> I'm surprised I've never noticed that before...

It's a precedence issue.  This:

[% SET cap = 'capitalised' | upper %]
[% cap %]

Is, effectively, this:

[% FILTER upper %][% SET cap = 'capitilized' %][% END %]
[% cap %]

SET has higher precedence than other operators.  You should make SET
operations their own statement.

-- 
(darren)

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to