adjust html to text

pull/604/merge
Pete Matsyburka 3 weeks ago
parent 9fcaef4cf7
commit 62f8283587

@ -10,7 +10,7 @@ module HtmlToPlainText
doc = Nokogiri::HTML.fragment(cleaned) doc = Nokogiri::HTML.fragment(cleaned)
doc.css('script').each(&:remove) doc.xpath('.//script').each(&:remove)
result = process_nodes(doc, line_length) result = process_nodes(doc, line_length)
@ -33,12 +33,9 @@ module HtmlToPlainText
result = +'' result = +''
node.children.each do |child| node.children.each do |child|
case child if child.text? || child.cdata?
when Nokogiri::XML::Text
result << child.text result << child.text
when Nokogiri::XML::Comment elsif child.element?
next
when Nokogiri::XML::Element
result << process_element(child, line_length) result << process_element(child, line_length)
end end
end end

Loading…
Cancel
Save