Skip to content

Commit

Permalink
Better parsing of emails form iOS Mail client
Browse files Browse the repository at this point in the history
  • Loading branch information
sbellity committed Jan 10, 2014
1 parent d1abfef commit 7a41864
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/griddler/email_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def self.regex_split_points
reply_delimeter_regex,
/^\s*[-]+\s*Original Message\s*[-]+\s*$/i,
/^\s*--\s*$/,
/^\s*\>?\s*On.*\r?\n?\s*.*\s*wrote:$/,
/On.*wrote:/,
/^\s*On.*\r?\n?\s*.*\s*wrote:$/,
/From:.*$/i,
/^\s*\d{4}\/\d{1,2}\/\d{1,2}\s.*\s<.*>?$/i
]
Expand Down
16 changes: 16 additions & 0 deletions spec/griddler/email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@
body_from_email(:text, body).should eq 'Hello.'
end

it 'handles "> On [date] [soandso] <[email protected]> wrote:" format' do
body = <<-EOF.strip_heredoc
Hello.
> On 10 janv. 2014, at 18:00, Tristan <[email protected]> wrote:
> Check out this report.
>
> It's pretty cool.
>
> Thanks, Tristan
>
EOF

body_from_email(:text, body).should eq 'Hello.'
end

it 'handles "From: [email protected]" format' do
body = <<-EOF
Hello.
Expand Down

0 comments on commit 7a41864

Please sign in to comment.