[Templates] IN keyword?

Jonathan Rockway jon at jrock.us
Sun Oct 7 21:58:04 BST 2007


Paul Makepeace wrote:
> I'm wondering if there's been any discussion on augmenting TT with a
> pythonic (and many others) IN keyword. Allowing something awesomely
> compact and readable like,
>
> <input type="checkbox" name="[% name %]" value="[% val %]"
> [% IF val IN c.req.param(name); 'checked="checked"'; END %] />
>
> I'm at a loss how to achieve that without building up a hash. Any tips?
How about:

   use Perl6::Junction;
   my $possible_values = any(@possible_values)
   ---
   [% IF value == possible_values %] value is one of @possible_values [%
END %]

Regards,
Jonathan Rockway


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 370 bytes
Desc: OpenPGP digital signature
Url : http://mail.template-toolkit.org/pipermail/templates/attachments/20071007/187dde0f/attachment.pgp 


More information about the templates mailing list