[Templates] Wrap text in an HTML tag
Ronald J Kimball
rkimball+tt at pangeamedia.com
Mon Feb 11 17:19:17 GMT 2008
Josh Rosenbaum wrote:
> Hi Ronald,
>
> The replace filter should work fine with backrefs if you're using a newer version of TT. (I believe 2.14a or above.)
Unfortunately, it's not working for me. Perhaps I'm overlooking something?
% perl -MTemplate -le 'print $Template::VERSION'
2.19
[% Catalyst.localize('You have [quant,_1,new message].',
new_message_count)
| replace('(\d+)', '<span class="highlight">$1</span>') %]
Result:
You have <span class="highlight">$1</span> new messages.
The $1 is inserted as a literal string.
Ronald
More information about the templates
mailing list