email_reply_parser 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -11
- data/email_reply_parser.gemspec +3 -0
- data/lib/email_reply_parser.rb +2 -2
- data/script/release +2 -0
- data/script/test +2 -0
- data/test/email_reply_parser_test.rb +9 -0
- data/test/emails/email_1_4.txt +3 -0
- data/test/emails/greedy_on.txt +16 -0
- metadata +5 -2
data/README.md
CHANGED
@@ -21,7 +21,7 @@ To parse reply body:
|
|
21
21
|
|
22
22
|
If you have a question about the behavior and formatting of email replies on GitHub, check out [support][support]. If you have a specific issue regarding this library, then hit up the [Issues][issues].
|
23
23
|
|
24
|
-
[support]:
|
24
|
+
[support]: https://github.com/support
|
25
25
|
[issues]: https://github.com/github/email_reply_parser/issues
|
26
26
|
|
27
27
|
## Installation
|
@@ -52,14 +52,8 @@ The best way to get your changes merged back into core is as follows:
|
|
52
52
|
|
53
53
|
### Quoted Headers
|
54
54
|
|
55
|
-
Quoted headers aren't picked up if
|
56
|
-
|
57
|
-
On <date>, <author> wrote:
|
58
|
-
|
59
|
-
> blah
|
60
|
-
|
61
|
-
Also, they're not picked up if the email client breaks it up into
|
62
|
-
multiple lines. GMail breaks up any lines over 80 characters for you.
|
55
|
+
Quoted headers aren't picked up if the email client breaks it up into multiple
|
56
|
+
lines. GMail breaks up any lines over 80 characters for you.
|
63
57
|
|
64
58
|
On <date>, <author>
|
65
59
|
wrote:
|
@@ -77,7 +71,7 @@ signatures:
|
|
77
71
|
|
78
72
|
Hello
|
79
73
|
|
80
|
-
--
|
74
|
+
--
|
81
75
|
Rick
|
82
76
|
|
83
77
|
Not everyone follows this convention:
|
@@ -91,4 +85,3 @@ Not everyone follows this convention:
|
|
91
85
|
**********************DISCLAIMER***********************************
|
92
86
|
* Note: blah blah blah *
|
93
87
|
**********************DISCLAIMER***********************************
|
94
|
-
|
data/email_reply_parser.gemspec
CHANGED
@@ -67,6 +67,8 @@ Gem::Specification.new do |s|
|
|
67
67
|
Rakefile
|
68
68
|
email_reply_parser.gemspec
|
69
69
|
lib/email_reply_parser.rb
|
70
|
+
script/release
|
71
|
+
script/test
|
70
72
|
test/email_reply_parser_test.rb
|
71
73
|
test/emails/correct_sig.txt
|
72
74
|
test/emails/email_1_1.txt
|
@@ -86,6 +88,7 @@ Gem::Specification.new do |s|
|
|
86
88
|
test/emails/email_one_is_not_on.txt
|
87
89
|
test/emails/email_sent_from_my_not_signature.txt
|
88
90
|
test/emails/email_sig_delimiter_in_middle_of_line.txt
|
91
|
+
test/emails/greedy_on.txt
|
89
92
|
test/emails/pathological.txt
|
90
93
|
]
|
91
94
|
# = MANIFEST =
|
data/lib/email_reply_parser.rb
CHANGED
@@ -30,7 +30,7 @@ require 'strscan'
|
|
30
30
|
#
|
31
31
|
# [mail]: https://github.com/mikel/mail
|
32
32
|
class EmailReplyParser
|
33
|
-
VERSION = "0.5.
|
33
|
+
VERSION = "0.5.8"
|
34
34
|
|
35
35
|
# Public: Splits an email body into a list of Fragments.
|
36
36
|
#
|
@@ -84,7 +84,7 @@ class EmailReplyParser
|
|
84
84
|
|
85
85
|
# Check for multi-line reply headers. Some clients break up
|
86
86
|
# the "On DATE, NAME <EMAIL> wrote:" line into multiple lines.
|
87
|
-
if text =~ /^(On\s(.+?)wrote:)$/nm
|
87
|
+
if text =~ /^(?!On.*On\s.+?wrote:)(On\s(.+?)wrote:)$/nm
|
88
88
|
# Remove all new lines from the reply header.
|
89
89
|
text.gsub! $1, $1.gsub("\n", " ")
|
90
90
|
end
|
data/script/release
ADDED
data/script/test
ADDED
@@ -181,6 +181,15 @@ I am currently using the Java HTTP API.\n", reply.fragments[0].to_s
|
|
181
181
|
assert_match /^On Oct 1, 2012/, reply.fragments[1].to_s
|
182
182
|
end
|
183
183
|
|
184
|
+
def test_mulitple_on
|
185
|
+
reply = email("greedy_on")
|
186
|
+
assert_match /^On your remote host/, reply.fragments[0].to_s
|
187
|
+
assert_match /^On 9 Jan 2014/, reply.fragments[1].to_s
|
188
|
+
assert_equal [false, true, false], reply.fragments.map { |f| f.quoted? }
|
189
|
+
assert_equal [false, false, false], reply.fragments.map { |f| f.signature? }
|
190
|
+
assert_equal [false, true, true], reply.fragments.map { |f| f.hidden? }
|
191
|
+
end
|
192
|
+
|
184
193
|
def test_pathological_emails
|
185
194
|
t0 = Time.now
|
186
195
|
reply = email("pathological")
|
data/test/emails/email_1_4.txt
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
On your remote host you can run:
|
2
|
+
|
3
|
+
telnet 127.0.0.1 52698
|
4
|
+
|
5
|
+
This should connect to TextMate (on your Mac, via the tunnel). If that
|
6
|
+
fails, the tunnel is not working.
|
7
|
+
|
8
|
+
On 9 Jan 2014, at 2:47, George Plymale wrote:
|
9
|
+
|
10
|
+
> I am having an odd issue wherein suddenly port forwarding stopped
|
11
|
+
> working in a particular scenario for me. By default I have ssh set to
|
12
|
+
> use the following config (my ~/.ssh/config file):
|
13
|
+
> […]
|
14
|
+
> ---
|
15
|
+
> Reply to this email directly or view it on GitHub:
|
16
|
+
> https://github.com/textmate/rmate/issues/29
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_reply_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Long description. Maybe copied from the README.
|
15
15
|
email: technoweenie@gmail.com
|
@@ -24,6 +24,8 @@ files:
|
|
24
24
|
- Rakefile
|
25
25
|
- email_reply_parser.gemspec
|
26
26
|
- lib/email_reply_parser.rb
|
27
|
+
- script/release
|
28
|
+
- script/test
|
27
29
|
- test/email_reply_parser_test.rb
|
28
30
|
- test/emails/correct_sig.txt
|
29
31
|
- test/emails/email_1_1.txt
|
@@ -43,6 +45,7 @@ files:
|
|
43
45
|
- test/emails/email_one_is_not_on.txt
|
44
46
|
- test/emails/email_sent_from_my_not_signature.txt
|
45
47
|
- test/emails/email_sig_delimiter_in_middle_of_line.txt
|
48
|
+
- test/emails/greedy_on.txt
|
46
49
|
- test/emails/pathological.txt
|
47
50
|
homepage: http://github.com/github/email_reply_parser
|
48
51
|
licenses: []
|