X-HTMLifying Code

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
Almost all of it violates some W3C spec for XHTML, the primary offenders
being capitalized tag names and unclosed tags like IMG. They also
ampersands as query-string separators, which also offends the W3C

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


View this message in context:
Sent from the RubyOnRails Users forum at Nabble.com.

regex is your friend.

I’m not 100% sure if these are what you’re after, but I think
they will help.


– Tom M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs