How can unwanted tags be removed from HTML using Nokogiri?
- by sutch
I need to strip out all font tags from a document. When attempting to do so with the following Ruby code, other elements and text within the font tags are lost. I've also attempted to iterate through all children elements and make them siblings of the font tag before unlinking the font tag--which also results in lost HTML. What is a good method for removing tags which can contain other elements and/or text?
doc.css('font').each do |element|
element.unlink
end