lib/display.rb in fastreader-1.0.0 vs lib/display.rb in fastreader-1.0.1
- old
+ new
@@ -130,10 +130,14 @@
def tags_to_text(html)
doc = Hpricot(html)
doc.search('//comment()').remove
- doc.search('p, div') do |p|
+ doc.search('div') do |p|
+ p.swap( "\n\n" + p.inner_text.gsub("\n", ' ').squeeze(' ').strip + "\n\n" )
+ end
+
+ doc.search('p') do |p|
p.swap( "\n\n" + p.inner_text.gsub("\n", ' ').squeeze(' ').strip + "\n\n" )
end
doc.search('//blockquote') do |x|
# compress extra spaces