Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Commit 35b39de

Browse files
committed
Merge pull request #245 from gust/issue-244
Adds split point for 3-line gmail inserts. Fixes #244
2 parents d360d46 + 9cdcc06 commit 35b39de

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lib/griddler/email_parser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def self.regex_split_points
8181
/^[[:space:]]*[-]+[[:space:]]*Original Message[[:space:]]*[-]+[[:space:]]*$/i,
8282
/^[[:space:]]*--[[:space:]]*$/,
8383
/^[[:space:]]*\>?[[:space:]]*On.*\r?\n?.*wrote:\r?\n?$/,
84+
/^On.*<\n?.*>.*\n?wrote:$/,
8485
/On.*wrote:/,
8586
/\*?From:.*$/i,
8687
/^[[:space:]]*\d{4}\/\d{1,2}\/\d{1,2}[[:space:]].*[[:space:]]<.*>?$/i

spec/griddler/email_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,24 @@
108108
expect(body_from_email(text: body)).to eq 'Hello.'
109109
end
110110

111+
it 'handles "On [date] [soandso]<\[email protected]>\nwrote:" format' do
112+
body = <<-EOF.strip_heredoc
113+
Hello.
114+
115+
On Jan 1, 2020 at 12:00 PM, Peter <
116+
117+
wrote:
118+
> My name is Peter
119+
>
120+
> Sorry, but my email address is very long
121+
>
122+
> and adds extra newlines to the delimiter
123+
EOF
124+
125+
expect(body_from_email(text: body)).to eq 'Hello.'
126+
end
127+
128+
111129
it 'handles "> On [date] [soandso] <[email protected]> wrote:" format' do
112130
body = <<-EOF.strip_heredoc
113131
Hello.

0 commit comments

Comments
 (0)