email_reply_trimmer 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa55f9a39546e85874c282caab367fdf9da3fa9a
4
- data.tar.gz: 5be88ed9382527d944029b9ef4a41077ac820e29
3
+ metadata.gz: c6eabb8ce3f3327f3abe63f3ee2fe147fb161d96
4
+ data.tar.gz: 7a07c2267ef47f4607a2ae2f05feac8c0a2584c1
5
5
  SHA512:
6
- metadata.gz: bf79309444ad1b47c679b475d8b943f8e7ad580d06b06305d9584336c803e84254fe019d269c6f5fb34660138263ac1028ac10ae2f647c40f934bc1fe937c040
7
- data.tar.gz: 5d5adaa21d0aaf5e492002bcf1c10a1c9f4b5bebd9e73a8ef7200e8eb9daaa01595b4dcbedcc8122fb7f637608d59ca8029b758b22ffd2915a02794c2c89dabe
6
+ metadata.gz: dba90e1fdc0b0a4f7032f9c2d1e9aabf575a390ee4cf39618037b9a820de8d7abad6338623b203211ef349dc3568b2e55440721dc89fa8ac144eda878cf0e463
7
+ data.tar.gz: 19be9d9b0496d31e81f7f7adb296d273aeea84130a8243d669857de751748a4e923584a14d4c8f0a90f338428e7dd219fa4212fddce38575b44ec58a598c5455
@@ -1,7 +1,7 @@
1
1
  class DelimiterMatcher
2
2
 
3
3
  DELIMITER_CHARACTERS ||= "-_,=+~#*ᐧ"
4
- DELIMITER_REGEX ||= /^[[:blank:]>]*[#{Regexp.escape(DELIMITER_CHARACTERS)}]+[[:blank:]]*$/
4
+ DELIMITER_REGEX ||= /^[[:blank:]]*[#{Regexp.escape(DELIMITER_CHARACTERS)}]+[[:blank:]]*$/
5
5
 
6
6
  def self.match?(line)
7
7
  line =~ DELIMITER_REGEX
@@ -6,7 +6,7 @@ require_relative "email_reply_trimmer/email_header_matcher"
6
6
  require_relative "email_reply_trimmer/quote_matcher"
7
7
 
8
8
  class EmailReplyTrimmer
9
- VERSION = "0.1.5"
9
+ VERSION = "0.1.6"
10
10
 
11
11
  DELIMITER = "d"
12
12
  EMBEDDED = "b"
@@ -58,6 +58,13 @@ class EmailReplyTrimmer
58
58
  lines.slice!(index)
59
59
  end
60
60
 
61
+ # when the reply is at the end of the email
62
+ if pattern =~ /^b+q+[eq]*t[te]*$/
63
+ index = pattern =~ /t/
64
+ pattern = ""
65
+ lines = lines[index..-1]
66
+ end
67
+
61
68
  # if there is an embedded email marker, not followed by a quote
62
69
  # then take everything up to that marker
63
70
  if pattern =~ /te*b[^q]*$/
@@ -0,0 +1,19 @@
1
+ Le 2016-11-16 02:22, Erlend Sogge Heggen a écrit :
2
+ > erlend_sh [1] Erlend Sogge Heggen [1] team
3
+ > November 16
4
+ >
5
+ > Hello French guy,
6
+ >
7
+ >> is the back office also available in french like the front end ?
8
+ >
9
+ > Oui!
10
+ >
11
+ > Sincerely,
12
+ >
13
+ > Erlend
14
+ >
15
+ > *
16
+ >
17
+ > Links:
18
+ > ------
19
+ > [1] https://meta.discourse.org/users/erlend_sh
@@ -0,0 +1,21 @@
1
+ Le 2016-11-16 02:22, Erlend Sogge Heggen a écrit :
2
+ > erlend_sh [1] Erlend Sogge Heggen [1] team
3
+ > November 16
4
+ >
5
+ > Hello French guy,
6
+ >
7
+ >> is the back office also available in french like the front end ?
8
+ >
9
+ > Oui!
10
+ >
11
+ > Sincerely,
12
+ >
13
+ > Erlend
14
+ >
15
+ > *
16
+ >
17
+ > Links:
18
+ > ------
19
+ > [1] https://meta.discourse.org/users/erlend_sh
20
+
21
+ Thanks for your answer.
@@ -0,0 +1 @@
1
+ Thanks for your answer.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_reply_trimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Régis Hanol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-16 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: EmailReplyTrimmer is a small library to trim replies from plain text
14
14
  email.
@@ -58,7 +58,8 @@ files:
58
58
  - test/elided/embedded_email_9.txt
59
59
  - test/elided/embedded_email_dutch_1.txt
60
60
  - test/elided/embedded_email_dutch_2.txt
61
- - test/elided/embedded_email_french.txt
61
+ - test/elided/embedded_email_french_1.txt
62
+ - test/elided/embedded_email_french_2.txt
62
63
  - test/elided/embedded_email_german_1.txt
63
64
  - test/elided/embedded_email_german_2.txt
64
65
  - test/elided/embedded_email_german_3.txt
@@ -99,7 +100,8 @@ files:
99
100
  - test/emails/embedded_email_9.txt
100
101
  - test/emails/embedded_email_dutch_1.txt
101
102
  - test/emails/embedded_email_dutch_2.txt
102
- - test/emails/embedded_email_french.txt
103
+ - test/emails/embedded_email_french_1.txt
104
+ - test/emails/embedded_email_french_2.txt
103
105
  - test/emails/embedded_email_german_1.txt
104
106
  - test/emails/embedded_email_german_2.txt
105
107
  - test/emails/embedded_email_german_3.txt
@@ -149,7 +151,8 @@ files:
149
151
  - test/trimmed/embedded_email_9.txt
150
152
  - test/trimmed/embedded_email_dutch_1.txt
151
153
  - test/trimmed/embedded_email_dutch_2.txt
152
- - test/trimmed/embedded_email_french.txt
154
+ - test/trimmed/embedded_email_french_1.txt
155
+ - test/trimmed/embedded_email_french_2.txt
153
156
  - test/trimmed/embedded_email_german_1.txt
154
157
  - test/trimmed/embedded_email_german_2.txt
155
158
  - test/trimmed/embedded_email_german_3.txt