FIX: Even better email rendering fixes

This commit is contained in:
Robin Ward 2016-07-12 15:37:19 -04:00
parent bb90129731
commit b00fd79989
1 changed files with 13 additions and 2 deletions

View File

@ -13,7 +13,9 @@ class EmailCook
def cook
result = ""
in_text = false
in_quote = false
quote_buffer = ""
@raw.each_line do |l|
@ -34,7 +36,16 @@ class EmailCook
end
result << l
result << "<br>" if sz < 60
if sz < 60
result << "<br>"
if in_text
result << "<br>"
end
in_text = false
else
in_text = true
end
end
end
@ -42,7 +53,7 @@ class EmailCook
result << "<blockquote>#{quote_buffer}</blockquote>"
end
result.gsub!(/(<br>){3,10}/, '<br><br>')
result.gsub!(/(<br>\n*){3,10}/, '<br><br>')
result
end