HTML-safe truncate


#1

Hello list,

Currently, I’m running a RoR website with a separate installation of
Wordpress (PHP), integrated into this website.
I want to post summaries of the posts in my RoR homepage, using
truncate to display the content.
However, WordPress stores the full HTML-enriched content in the table
(so foo is directly in the table). If I truncate()
that text in my RoR view, I can’t be sure all HTML is preserved, and
all tags are closed (eg. <a href="…).

Is there any way to resolve this problem? Maybe a HTML-tag-sentient
truncate out there?
Googled to no avail…

thanks a bunch,
bartz

http://www.djtrx.com/