[Templates] auto filtering

darren chamberlain dlc@users.sourceforge.net
Tue, 12 Nov 2002 13:25:58 -0500


* Mark Fowler <mark@twoshortplanks.com> [2002-11-12 11:20]:
> On Tue, 12 Nov 2002, Andy Wardley wrote:
> > You could write a custom stash which puts a wrapper around the 
> > get() method, filtering all the output that it returns.
> 
> Putting it at the stash level seems to be a mistake to me...you often
> want to manipulate the data and do a lot of stuff and not have to
> worry about filtering it until the last matter.

I came to exactly the same conclusion when I decided to spend a few
minutes trying to implement it.

> Since we're talking about being lazy here, I'd probably implement it
> as an option to auto filter interpolated variables.  So in this
> example:
> 
>   This is a [% foo %] with very many $bar.
> 
> foo would not be filtered, but $bar would be.  This seems to give you
> the right degree of balance between convenience and flexibility.

Interesting... as long as we can assume that we're talking about HTML.
I would hate for my GD images to be HTML encoded, for example.  That's
why filters are optional, and need to be specified explicitly.

(darren)

-- 
How can I believe in God when just last week I got my tongue caught in
the roller of an electric typewriter?
    -- Woody Allen