File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,6 +83,12 @@ def read(text)
8383 text . gsub! $1, $1. gsub ( "\n " , " " )
8484 end
8585
86+ # Some users may reply directly above a line of underscores.
87+ # In order to ensure that these fragments are split correctly,
88+ # make sure that all lines of underscores are preceded by
89+ # at least two newline characters.
90+ text . gsub! ( /([^\n ])(?=\n _{7}_+)$/m , "\\ 1\n " )
91+
8692 # The text is reversed initially due to the way we check for hidden
8793 # fragments.
8894 text = text . reverse
Original file line number Diff line number Diff line change @@ -111,6 +111,11 @@ def test_parse_out_just_top_for_outlook_reply
111111 assert_equal "Outlook with a reply" , EmailReplyParser . parse_reply ( body )
112112 end
113113
114+ def test_parse_out_just_top_for_outlook_with_reply_directly_above_line
115+ body = IO . read EMAIL_FIXTURE_PATH . join ( "email_2_2.txt" ) . to_s
116+ assert_equal "Outlook with a reply directly above line" , EmailReplyParser . parse_reply ( body )
117+ end
118+
114119 def test_parse_out_sent_from_iPhone
115120 body = IO . read EMAIL_FIXTURE_PATH . join ( "email_iPhone.txt" ) . to_s
116121 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