Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Forked from mperham/gist:422886
Created June 21, 2010 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenderlove/446277 to your computer and use it in GitHub Desktop.
Save tenderlove/446277 to your computer and use it in GitHub Desktop.
require 'nokogiri'
html = 'CA<br/>Sr Technical Architect'
fragment = Nokogiri::HTML::DocumentFragment.parse(html)
fragment.traverse do |child|
next unless 'br' == child.name
child.replace Nokogiri::XML::Text.new(' ', child.document)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment