Skip to content

Instantly share code, notes, and snippets.

@bricker
Created August 1, 2014 04:18
Show Gist options
  • Select an option

  • Save bricker/c6b8ff7e08d0231ac414 to your computer and use it in GitHub Desktop.

Select an option

Save bricker/c6b8ff7e08d0231ac414 to your computer and use it in GitHub Desktop.
if %w[ p h1 h2 h3 h4 h5 h6 h7 div span strong em ].include?(node.name) &&
(
node.children.empty? ||
( node.children.all? { |n| n.name == "text" } && node.content.strip.empty? )
)
node.remove
return
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment