I have something like this: [% query | html %]
Now I would like to use it as
[% MACRO l(text, args) BLOCK; c.localize(text, args); END; %]
[% l开发者_运维百科('text:<b>[_1]</b> no:[_2]', [query | html,2]) %]
If you try that example it will not work because |
cannot be used there. That is not accepted by Template Toolkit. I want to HTML-escape query
. How can I do that?
To move <b>
out of the quotes is not a solution because the translation may not have the same order as above.
You can [% USE HTML %]
and escape a specific parameter, for example:
[% USE HTML %]
[%# your code above %]
[% l('text:<b>[_1]</b> no:[_2]', HTML.escape(query), 2) %]
精彩评论