Can I somehow configure Template Toolkit so that:
[% foo %]
does what you would now need to say:
[% foo | html %]
that is, escape HTML in foo
? And do something else, like:
[% foo | noHtml %]
if I don't want to escape?
Came across your question when trying to answer the same question for myself.
http://search.cpan.org/~mithaldu/Template-AutoFilter/ seems to do what we want, but it does require installing another module. I'm going to give it a try anyway.
I guess you could create your own stash by extending Template::Stash so that it would by default escape variables.
That said I think it is not a good idea. Better to stick with default behaviour and refrain from custom modifications as they are certainly confusing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With