Hello all,
In a summary page I need to show the 1st 100 chars of textilized
messages.
Problem: truncate(…) would often cut in the middle of html tags =>
random result.
My first idea was to “repair” the broken text with Hpricot (as I use
it elsewhere in the project), but it’s not perfect:
abcd</h
would give
abcd</h
(I also use white_list to clean the …)
I guess there are only 2 alternatives:
- a smart html_truncate(…)
or - “unrender” the text (html => plain text)
Has anybody explored those directions?
TIA
Alain R…