Forum: Ruby on Rails X-HTMLifying Code

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.
Ef0db53920b243d6758c2f6b1306df0d?d=identicon&s=25 Steve Ross (cwd)
on 2006-04-10 04:19
(Received via mailing list)
This falls into the category of "wonder if anyone's done this"?

The site I'm working on now has affiliate sponsors who provide link
HTML.
Almost all of it violates some W3C spec for XHTML, the primary offenders
being capitalized tag names and unclosed tags like IMG. They also
include
ampersands as query-string separators, which also offends the W3C
Validator.

Has anyone written a snippet to parse links and image tags to make them
XHTML Transitional safe?

This works in some but not all cases:

@affiliates.each{|a| a.link_html = a.link_html.gsub('&', ';').downcase}
#
not sure about the ; bit

TIA
--
View this message in context:
http://www.nabble.com/X-HTMLifying-Code-t1422594.h...
Sent from the RubyOnRails Users forum at Nabble.com.
31ae911dd0fe0ee0b81519d6d2627886?d=identicon&s=25 Gravy Face (gravyface)
on 2006-04-10 04:28
(Received via mailing list)
regex is your friend.
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-04-10 05:41
(Received via mailing list)
I'm not 100% sure if these are what you're after, but I think
they will help.

http://tinyurl.com/hqs4h
http://tinyurl.com/hehue

--
-- Tom Mornini
This topic is locked and can not be replied to.