Skip to content

Instantly share code, notes, and snippets.

@mojombo mojombo/omg.rb forked from tenderlove/omg.rb
Created Jan 6, 2011

Embed
What would you like to do?
require 'nokogiri'
doc = Nokogiri.HTML DATA
doc.xpath('//div//text()').map { |x| x.content = x.to_s }
p doc.serialize(:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)
__END__
<div>&nbsp;<span>x</span></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.