Forum: Ruby on Rails HTML-safe truncate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
nemo (Guest)
on 2007-02-20 11:43
(Received via mailing list)
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 <a href="etc">foo</a> 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/
This topic is locked and can not be replied to.