FIX: handle multiple paragraphs in email reply when parsing html
This commit is contained in:
parent
c46b9c0ac3
commit
b457005b07
|
@ -76,7 +76,7 @@ module Email
|
|||
def add_newlines(doc)
|
||||
# Replace <br> tags with a markdown \n
|
||||
doc.xpath('//br').each do |br|
|
||||
br.replace(new_linebreak_node doc)
|
||||
br.replace(new_linebreak_node doc, 2)
|
||||
end
|
||||
# Surround <p> tags with newlines, to help with line-wise postprocessing
|
||||
# and ensure markdown paragraphs
|
||||
|
|
|
@ -82,6 +82,17 @@ Thanks for listening."
|
|||
)
|
||||
end
|
||||
|
||||
it "handles multiple paragraphs when parsing html" do
|
||||
test_parse_body(fixture_file("emails/html_paragraphs.eml")).
|
||||
should == (
|
||||
"Awesome!
|
||||
|
||||
Pleasure to have you here!
|
||||
|
||||
:boom:"
|
||||
)
|
||||
end
|
||||
|
||||
it "converts back to UTF-8 at the end" do
|
||||
result = test_parse_body(fixture_file("emails/big5.eml"))
|
||||
result.encoding.should == Encoding::UTF_8
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue