public
Fork of sr/atom-tools
Description: A Ruby library for Atom and the Atom Publishing Protocol.
Home | Edit | New

HtmlToXhtml

Proper XML tools deserve proper XML content. If you have Hpricot installed, atom-tools can convert HTML text elements to XHTML:

[:title, :content, :summary].each do |text_type|
  if entry.send(text_type) and entry.send(text_type)["type"] == "html"
    entry.send("#{text_type}=", entry.send(text_type).xml)
    entry.send(text_type)["type"] = "xhtml"
  end
end
Last edited by bct, Fri Oct 17 13:29:58 -0700 2008
Home | Edit | New
Versions: