On Sat, Dec 13, 2008 at 10:20:09PM +0100, Ansgar Burchardt wrote:
> > I have separate localization functions specifically for this reason.
> > Only the substitution parameters are escaped before placed in the
> > localization string.
>
> Can you explain in a bit more detail? If I understand correctly, you
> have functions like l_html(s, a), l_url(s, a) which escape `a' before
> placing them in the substitution?
Correct. I also have one more for creating links since it's one of
the more common tasks where I pass in a path, link text and optional
title. My normal loc() filter does not escape, so it's always:
loc( foo ) | html;
The others are special case and handle the escaping. If I needed to
filter I'd do that before calling the localization code.
> But doesn't this lead to an additional function for every combination of
> filters used?
Not sure I understand your question.
> I would prefer just writing
> l(s, a.html) or l(s, a | html)
> or something similar. The former would just require that filters are
> also registered as scalar virtual methods as well, as is already the
> case for some (e.g. `repeat', `replace'). I think this might be useful
> in other cases as well.
IIRC "l(s, a.html)" is ok, but TT won't parse "l(s, a | html )".
--
Bill Moseley
[email protected]
Sent from my iMutt
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates