On 7/31/12 9:56 AM, Dave Howorth wrote:
Felipe Gasper (cPanel) wrote:
Any chance this could make it into a forthcoming TT release?
our $TEXT_VMETHODS = {
...
dquote => \&text_dquote,
html => \&Template::Filters::html_filter,
xml => \&Template::Filters::xml_filter,
uri => \&Template::Filters::uri_filter,
};
It seems like it’d be very (and conspicuously?) useful.
Pardon my ignorance but what's the advantage of a vmethod over a filter
for html, xml & uri? And isn't dquote already a vmethod?
The advantage of a vmethod over a filter is that you can more easily
store/manipulate the result than with a filter. You can also chain
vmethods, e.g., foo.json().html(). (I can’t see any advantage of a
filter over a vmethod, though?)
I should clarify: dquote(), html(), and xml() are all currently vmethods
as of TT 2.24. (I meant to clarify that in the above code, sorry!) uri()
was not added in at that time, but I’ve not understood why. An
environment where HTML escaping is pertinent very likely will want URI
escaping as well.
-FG
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates