File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,12 @@ def read(text)
8989 text . gsub! $1, $1. gsub ( "\n " , " " )
9090 end
9191
92+ # Some users may reply directly above a line of underscores.
93+ # In order to ensure that these fragments are split correctly,
94+ # make sure that all lines of underscores are preceded by
95+ # at least two newline characters.
96+ text . gsub! ( /([^\n ])(?=\n _{7}_+)$/m , "\\ 1\n " )
97+
9298 # The text is reversed initially due to the way we check for hidden
9399 # fragments.
94100 text = text . reverse
Original file line number Diff line number Diff line change @@ -119,6 +119,11 @@ def test_parse_out_just_top_for_outlook_reply
119119 assert_equal "Outlook with a reply" , EmailReplyParser . parse_reply ( body )
120120 end
121121
122+ def test_parse_out_just_top_for_outlook_with_reply_directly_above_line
123+ body = IO . read EMAIL_FIXTURE_PATH . join ( "email_2_2.txt" ) . to_s
124+ assert_equal "Outlook with a reply directly above line" , EmailReplyParser . parse_reply ( body )
125+ end
126+
122127 def test_parse_out_sent_from_iPhone
123128 body = IO . read EMAIL_FIXTURE_PATH . join ( "email_iPhone.txt" ) . to_s
124129 assert_equal "Here is another email" , EmailReplyParser . parse_reply ( body )
Original file line number Diff line number Diff line change 1+ Outlook with a reply directly above line
2+ ________________________________________
3+ From: CRM Comments [crm-comment@example.com]
4+ Sent: Friday, 23 March 2012 5:08 p.m.
5+ To: John S. Greene
6+ Subject: [contact:106] John Greene
7+
8+ A new comment has been added to the Contact named 'John Greene':
9+
10+ I am replying to a comment.
You can’t perform that action at this time.
0 commit comments