FIX: Even better email rendering fixes
This commit is contained in:
parent
bb90129731
commit
b00fd79989
1 changed files with 13 additions and 2 deletions
|
@ -13,7 +13,9 @@ class EmailCook
|
||||||
def cook
|
def cook
|
||||||
result = ""
|
result = ""
|
||||||
|
|
||||||
|
in_text = false
|
||||||
in_quote = false
|
in_quote = false
|
||||||
|
|
||||||
quote_buffer = ""
|
quote_buffer = ""
|
||||||
@raw.each_line do |l|
|
@raw.each_line do |l|
|
||||||
|
|
||||||
|
@ -34,7 +36,16 @@ class EmailCook
|
||||||
end
|
end
|
||||||
|
|
||||||
result << l
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,7 +53,7 @@ class EmailCook
|
||||||
result << "<blockquote>#{quote_buffer}</blockquote>"
|
result << "<blockquote>#{quote_buffer}</blockquote>"
|
||||||
end
|
end
|
||||||
|
|
||||||
result.gsub!(/(<br>){3,10}/, '<br><br>')
|
result.gsub!(/(<br>\n*){3,10}/, '<br><br>')
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Reference in a new issue