Skip Menu |

This queue is for tickets about the Template-AutoFilter CPAN distribution.

Report information
The Basics
Id: 90643
Status: resolved
Priority: 0/
Queue: Template-AutoFilter

People
Owner: Nobody in particular
Requestors: tsibley [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.132690
Fixed in: (no value)



Subject: Compound IF statements aren't autofiltered
Currently one limitation is that statements like the following aren't autofiltered: [% IF foo; bar; ELSE; baz; END %] Unfortunately, it's a little more complicated because trying to filter the whole result by tacking | html onto the end is a syntax error. I suppose split_text could break at ; tokens and recurse the "do I autofilter this or not?" logic on the inner statements. Perhaps that's more than is necessary though, and special-casing the simple ternary style above would help 90% of cases. Thanks for this module, by the way. I inherited a large collection of TT2 templates and couldn't believe it didn't have native default filtering! I would like to switch to AutoFilter, so I may make a patch myself and submit it unless someone beats me to it. Thomas
It's worth noting that my simple example of an IF ... ELSE compound statement can be replaced by a Perl-style ternary op [% foo ? bar : baz %] and this will be autofiltered. It'd still be nice for compound statements to work, however, especially in cases more complex than a simple ternary: [% FOR foo IN list; 'Element: ' _ foo; END %]
Sent a pull request adding this feature: https://github.com/wchristian/Template-AutoFilter/pull/3
And this was fixed in a release just pushed to CPAN. :)