On Wed, May 12, 2010 at 10:29 AM, Randal L. Schwartz <[email protected]> wrote: >>>>>> "E" == E R <[email protected]> writes: > > E> I'd like to see TT adopt a convention which would allow the caller to > E> pass in already HTML-escaped data. The effect of the '| html' filter > E> would effectively be a no-op. E.g, something like: > > It is *impossible* to determine whether something is HTML-entitized or > not. Other than psychic powers, how do you propose to distinguish > escaped data from unescaped data?
I think you misunderstand my proposal. The caller specifies what kind of data is being passed. In the virtual method example, if the caller passes a plain string, the ".to_html" virtual method will perform the standard HTML escaping transformation. If the caller passes a blessed reference, which implements a ->to_html method, the ".to_html" call will be handled by that method. So the first idea is to delegate the html escaping to the data itself. The second idea is to hook this into TT's '| html' filter. _______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
