From: "Josh Rosenbaum" <[email protected]>

> Octavian Râşniţă wrote:
>> Hi,
>>
>>     Is there a filter for TT that gets an HTML string as input and 
>> returns the text outside of the HTML elements?
>>
>> Something like:
>>
>> [% "<b>text</b>" | TheFilter %]
>>
>> should return just "text".
>
> There's also at least one plugin that adds this:
> http://search.cpan.org/~gsimmons/Template-Plugin-HTML-Strip-0.01/lib/Template/Plugin/HTML/Strip.pm
>
> -- Josh

Thank you Josh and Bill.

This TT plugin would be exactly what I need, but unfortunately it doesn't 
print correctly the UTF-8 chars. I have read the POD docs of HTML::Strip 
also, but I couldn't find anything about setting the charset or something 
like that.

So I think that making an HTML::Strip -based custom script will have the 
same results.

I need that kind of filter because I need to get some longer HTML content, 
and truncate it and then print the text, but if I just truncate the HTML, it 
might give bad results because I could start a table or list or link without 
ending them...

Octavian




_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to