Skip to content

Instantly share code, notes, and snippets.

@edward
Last active August 29, 2015 14:15
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 edward/92e8bdfcd3ee50d4c81a to your computer and use it in GitHub Desktop.
Save edward/92e8bdfcd3ee50d4c81a to your computer and use it in GitHub Desktop.
require 'nokogiri'
html = %(<div class="next-input-wrapper"><label class="next-label next-label--switch" for="radio-2"><input class="next-radio" id="radio-2" name="radio-group" type="radio" value="2" /><span class="next-radio--styled"></span>A longer label with text that wraps (just resize the iframe to see me in action!)</label></div>)
doc = Nokogiri::XML(html,&:noblanks)
puts doc.to_xml
__END__
<div class="next-input-wrapper">
<label for="radio-2" class="next-label next-label--switch">
<input type="radio" class="next-radio" id="radio-2" name="radio-group" />
<span class="next-radio--styled"></span>
A longer label with text that wraps (just resize the iframe to see me in action!)
</label>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment