email_reply_trimmer 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/email_reply_trimmer.rb +57 -22
  3. data/lib/email_reply_trimmer/delimiter_matcher.rb +1 -1
  4. data/lib/email_reply_trimmer/email_header_matcher.rb +25 -13
  5. data/lib/email_reply_trimmer/embedded_email_matcher.rb +51 -25
  6. data/lib/email_reply_trimmer/signature_matcher.rb +16 -9
  7. data/test/elided/email_headers_5.txt +23 -0
  8. data/test/elided/embedded_ception.txt +3 -3
  9. data/test/elided/embedded_email_12.txt +2 -2
  10. data/test/elided/embedded_email_13.txt +9 -0
  11. data/test/elided/embedded_email_14.txt +11 -0
  12. data/test/elided/embedded_email_15.txt +4 -0
  13. data/test/elided/embedded_email_16.txt +4 -0
  14. data/test/elided/embedded_email_17.txt +2 -0
  15. data/test/elided/embedded_email_18.txt +1 -0
  16. data/test/elided/embedded_email_19.txt +0 -0
  17. data/test/elided/embedded_email_chinese.txt +4 -0
  18. data/test/elided/embedded_email_german_4.txt +15 -0
  19. data/test/elided/embedded_email_german_5.txt +20 -0
  20. data/test/elided/embedded_email_german_6.txt +8 -0
  21. data/test/elided/embedded_email_norwegian.txt +9 -0
  22. data/test/elided/embedded_email_quote_text.txt +5 -0
  23. data/test/elided/{embedded_email_russian.txt → embedded_email_russian_1.txt} +0 -0
  24. data/test/elided/embedded_email_russian_2.txt +23 -0
  25. data/test/elided/embedded_email_swedish.txt +8 -0
  26. data/test/elided/signatures.txt +2 -0
  27. data/test/emails/email_headers_5.txt +37 -0
  28. data/test/emails/embedded_email_1.txt +1 -1
  29. data/test/emails/embedded_email_13.txt +14 -0
  30. data/test/emails/embedded_email_14.txt +16 -0
  31. data/test/emails/embedded_email_15.txt +9 -0
  32. data/test/emails/embedded_email_16.txt +16 -0
  33. data/test/emails/embedded_email_17.txt +38 -0
  34. data/test/emails/embedded_email_18.txt +7 -0
  35. data/test/emails/embedded_email_19.txt +13 -0
  36. data/test/emails/embedded_email_4.txt +13 -13
  37. data/test/emails/embedded_email_7.txt +4 -4
  38. data/test/emails/embedded_email_chinese.txt +7 -0
  39. data/test/emails/embedded_email_german_4.txt +18 -0
  40. data/test/emails/embedded_email_german_5.txt +23 -0
  41. data/test/emails/embedded_email_german_6.txt +14 -0
  42. data/test/emails/embedded_email_norwegian.txt +11 -0
  43. data/test/emails/{embedded_email_russian.txt → embedded_email_russian_1.txt} +0 -0
  44. data/test/emails/embedded_email_russian_2.txt +26 -0
  45. data/test/emails/embedded_email_swedish.txt +20 -0
  46. data/test/emails/signatures.txt +2 -0
  47. data/test/test_email_reply_trimmer.rb +2 -2
  48. data/test/trimmed/email_headers_5.txt +11 -0
  49. data/test/trimmed/embedded_email_13.txt +3 -0
  50. data/test/trimmed/embedded_email_14.txt +3 -0
  51. data/test/trimmed/embedded_email_15.txt +3 -0
  52. data/test/trimmed/embedded_email_16.txt +11 -0
  53. data/test/trimmed/embedded_email_17.txt +35 -0
  54. data/test/trimmed/embedded_email_18.txt +5 -0
  55. data/test/trimmed/embedded_email_19.txt +13 -0
  56. data/test/trimmed/embedded_email_chinese.txt +2 -0
  57. data/test/trimmed/embedded_email_german_4.txt +1 -0
  58. data/test/trimmed/embedded_email_german_5.txt +1 -0
  59. data/test/trimmed/embedded_email_german_6.txt +4 -0
  60. data/test/trimmed/embedded_email_norwegian.txt +1 -0
  61. data/test/trimmed/embedded_email_quote_text.txt +0 -5
  62. data/test/trimmed/{embedded_email_russian.txt → embedded_email_russian_1.txt} +0 -0
  63. data/test/trimmed/embedded_email_russian_2.txt +1 -0
  64. data/test/trimmed/embedded_email_swedish.txt +9 -0
  65. metadata +51 -6
@@ -1,8 +1,8 @@
1
- On Thu, 31 Mar 2016 at 11:16 Some One < mailto:Some One <some.one@foo.bar> wrote:
1
+ On Thu, 31 Mar 2016 at 11:16 Some One < mailto:Some One <some.one@foo.bar> > wrote:
2
2
 
3
3
 
4
4
  Two 2
5
5
 
6
- On Thu, 31 Mar 2016 at 10:05 Jeff Atwood < mailto:Jeff Atwood <team@discourse.org> wrote:
6
+ On Thu, 31 Mar 2016 at 10:05 Jeff Atwood < mailto:Jeff Atwood <team@discourse.org> > wrote:
7
7
 
8
8
  Three 3
@@ -0,0 +1,9 @@
1
+ At 6/16/2016 08:32 PM, you wrote:
2
+ ><https://meta.discourse.org/users/codinghorror>codinghorror
3
+ ><https://meta.discourse.org/users/codinghorror>Jeff Atwood co-founder
4
+ >June 17
5
+ >
6
+ >Sorry I got a little mixed up with all the incoming replies. Are you
7
+ >able to log in?
8
+ >
9
+ >Use your email address and "forgot password" if you need it reset.
@@ -0,0 +1,11 @@
1
+ 2016-10-24 15:36 GMT+02:00 Foo bar < info@foo.bar>:
2
+
3
+ > Thank you so much Erlend, very thanks!
4
+ >
5
+ > 2016-10-24 15:03 GMT+02:00 Erlend Sogge Heggen <meta@discoursemail.com>:
6
+ >
7
+ >> erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge
8
+ >> Heggen <https://meta.discourse.org/users/erlend_sh> team
9
+ >> October 24
10
+ >>
11
+ >> I received your application and I've replied with setup instructions.
@@ -0,0 +1,4 @@
1
+ 2017-02-05 13:29 GMT+02:00 Very long author name < notifications@forum.some-discourse-host.local>:
2
+
3
+ > [Original Messages is quoted here]
4
+ > [...]
@@ -0,0 +1,4 @@
1
+ --
2
+ Eric Hodel - drbrain@segment7.net - http://segment7.net
3
+ All messages signed with fingerprint:
4
+ FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
@@ -0,0 +1,2 @@
1
+ On 15 May 2017 19:32, "Nomadic Sprite" <nomadic.sprite01@gmail.com> wrote:
2
+ On 8 May 2017 6:51 pm, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
@@ -0,0 +1 @@
1
+ On 8 May 2017 17:34, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
File without changes
@@ -0,0 +1,4 @@
1
+ > 在 2016年12月12日,下午8:45,Erlend Sogge Heggen <meta@discoursemail.com> 写道:
2
+ > fu.zhang:
3
+ > Some random question
4
+ >
@@ -0,0 +1,15 @@
1
+ Max Mustermann <try_discourse@discoursemail.com> schrieb am Fr., 28. Apr. 2017 um 11:53 Uhr:
2
+
3
+ > max_2 <http://try.discourse.org/u/cfstras_2>
4
+ > April 28
5
+
6
+ > Hi there! you should be getting a mail.
7
+ > ------------------------------
8
+
9
+ > Visit Topic <http://try.discourse.org/t/this-is-my-internal-test/716/2>
10
+ > or reply to this email to respond.
11
+
12
+ > To unsubscribe from these emails, click here
13
+ > <http://try.discourse.org/email/unsubscribe/badf00d>
14
+ > .
15
+
@@ -0,0 +1,20 @@
1
+ Erlend Sogge Heggen <meta@discoursemail.com> schrieb am Di., 16. Aug. 2016 um 12:52 Uhr:
2
+
3
+ > erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge Heggen
4
+ > <https://meta.discourse.org/users/erlend_sh> team
5
+ > August 16
6
+ >
7
+ > Hi Bob,
8
+ >
9
+ > Sure, it sounds like your requirements would fit our Standard plan. I
10
+ > suggest you sign up for a free trial, as that will be the best way to see
11
+ > for yourself if we support the kind of custom styling
12
+ >
13
+ > Sincerely,
14
+ >
15
+ > Erlend
16
+ >
17
+ --
18
+ Viele Grüße / Best regards
19
+
20
+ Bob
@@ -0,0 +1,8 @@
1
+ Am 21.04.2016 17:48 schrieb "Einz Zwei" <noreply@discourse.pseuco.com >:
2
+
3
+ > einz.zwei <https://discourse.pseuco.com/users/einz.zwei> einz
4
+ > zwei <https://discourse.pseuco.com/users/einz.zwei>
5
+ > 21. April
6
+ >
7
+ > Vielleicht noch eine wichtige Frage:
8
+ > Wann sollten wir diese Trainingsvideos veröffentlichen, es gibt 2
@@ -0,0 +1,9 @@
1
+ Sendt fra min iPad
2
+
3
+ Den 15. jun. 2016 kl. 20.42 skrev Jeff Atwood <info@discourse.org<mailto:info@discourse.org>>:
4
+
5
+ codinghorror<https://meta.discourse.org/users/codinghorror> Jeff Atwood<https://meta.discourse.org/users/codinghorror> co-founder
6
+ June 15
7
+
8
+
9
+ Enable tags in your admin, site settings.
@@ -1 +1,6 @@
1
1
  On Mon, Aug 19, 2013 at 2:36 AM, SomeOne via Discourse Meta < info@discourse.org> wrote:
2
+
3
+ > This seems like a problem that would be better solved at the web server
4
+ > level, rather than by the application. If nothing else, adding an instance
5
+ > of Nginx as an SSL/TLS reverse-proxy would very quickly take care of this.
6
+ >
@@ -0,0 +1,23 @@
1
+ 20 окт. 2016 г. 19:37 пользователь "Rafael dos Santos Silva" < meta@discoursemail.com> написал:
2
+
3
+ > Falco <https://meta.discourse.org/users/falco> Rafael dos Santos Silva
4
+ > <https://meta.discourse.org/users/falco> team
5
+ > October 20
6
+ >
7
+ > Are you using our official docker install?
8
+ >
9
+ > If you are, try a rebuild:
10
+ >
11
+ > ssh root@server
12
+ > cd /var/discourse
13
+ > ./launcher rebuild app
14
+ >
15
+ > ------------------------------
16
+ >
17
+ > Visit Topic <https://meta.discourse.org/t/error-upgrading/51797/2> or
18
+ > reply to this email to respond.
19
+ >
20
+ > To unsubscribe from these emails, click here
21
+ > <https://meta.discourse.org/email/unsubscribe/184ce11578cd0abaddcb6e7460708971afed7278523347d3184a421229d87d08>
22
+ > .
23
+ >
@@ -0,0 +1,8 @@
1
+ Från: Foo Bar [mailto:noreply@foo.bar]
2
+ Skickat: den 5 juni 2017 12:22
3
+ Till: someone@domain.com
4
+ Ämne: [WAT] Photos from the symposium
5
+
6
+ If you have any pictures from any parts of the symposium that you are willing to share, please reply to this post to share them (you can simply copy and paste or drag'n'drop them into the text).
7
+
8
+ Here are the group pictures we took on Wednesday after lunch.
@@ -24,3 +24,5 @@ Sent from my Windows 8 PC <http://windows.microsoft.com/consumer-preview>
24
24
  (sent from a phone)
25
25
  (Sent from mobile device)
26
26
  從我的 iPhone 傳送
27
+
28
+ Get Outlook for iOShttps://aka.ms/o0ukef
@@ -0,0 +1,37 @@
1
+ Hi Erlend,
2
+
3
+ I don’t know what a “legally recognised educational institution” means for you.
4
+
5
+ We’re based in Sweden and we provide education to our people across the globe.
6
+
7
+ We want to try Discourse in small scale first to see it will add value to our communities.
8
+
9
+ Best regards,
10
+
11
+ //Jef
12
+
13
+
14
+
15
+ From: Erlend Sogge Heggen <meta@discoursemail.com>
16
+ Reply-To: Erlend Sogge Heggen <meta+abcd@discoursemail.com>
17
+ Date: Wednesday, 5 April 2017 at 17:01
18
+ To: Jef <jef@bar.com>
19
+ Subject: [Discourse Meta] [PM] Discourse for Communities of Practice, educational organisation
20
+
21
+
22
+ erlend_sh<https://meta.discourse.org/u/erlend_sh> Erlend Sogge Heggen<https://meta.discourse.org/u/erlend_sh> Team
23
+ April 5
24
+
25
+
26
+
27
+ Hi Jef,
28
+
29
+ Is your University a legally recognised educational institution? Otherwise I'm afraid you're not eligible for this discount.
30
+
31
+ Sincerely,
32
+
33
+ Erlend
34
+
35
+
36
+
37
+ This email message and any attachments may contain confidential information and may be privileged. If you are not the intended recipient or otherwise not authorized to receive this message, you are prohibited to use, copy, disclose or take any action based on this email or any information contained herein. If you are not the intended recipient, please advise the sender immediately by replying to this email and permanently delete this message and any attachments from your system.
@@ -2,7 +2,7 @@ This is before the embedded email.
2
2
 
3
3
  On Wed, Sep 25, 2013, at 03:57 PM, richard_clark wrote:
4
4
 
5
- > This is the embedded email
5
+ Richard> This is the embedded email
6
6
 
7
7
  This is after the embedded email and will not show up because 99% of the times
8
8
  this is the signature...
@@ -0,0 +1,14 @@
1
+ yes we're fine
2
+
3
+ thanks
4
+
5
+
6
+ At 6/16/2016 08:32 PM, you wrote:
7
+ ><https://meta.discourse.org/users/codinghorror>codinghorror
8
+ ><https://meta.discourse.org/users/codinghorror>Jeff Atwood co-founder
9
+ >June 17
10
+ >
11
+ >Sorry I got a little mixed up with all the incoming replies. Are you
12
+ >able to log in?
13
+ >
14
+ >Use your email address and "forgot password" if you need it reset.
@@ -0,0 +1,16 @@
1
+ I just saw the standard plan has the slack integration.
2
+
3
+ Thank you!
4
+
5
+ 2016-10-24 15:36 GMT+02:00 Foo bar <
6
+ info@foo.bar>:
7
+
8
+ > Thank you so much Erlend, very thanks!
9
+ >
10
+ > 2016-10-24 15:03 GMT+02:00 Erlend Sogge Heggen <meta@discoursemail.com>:
11
+ >
12
+ >> erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge
13
+ >> Heggen <https://meta.discourse.org/users/erlend_sh> team
14
+ >> October 24
15
+ >>
16
+ >> I received your application and I've replied with setup instructions.
@@ -0,0 +1,9 @@
1
+ [message body]
2
+
3
+ / Greetings
4
+
5
+ 2017-02-05 13:29 GMT+02:00 Very long author name <
6
+ notifications@forum.some-discourse-host.local>:
7
+
8
+ > [Original Messages is quoted here]
9
+ > [...]
@@ -0,0 +1,16 @@
1
+ > From: "Albert Wagner" <alwagner@tcac.net>
2
+ >
3
+ > > Some guy at ibraheem@localhost(?) needs to be unsubscribed. I
4
+ > > keep getting bounces from his ISP everytime I post. Surely,
5
+ > > everyone else is getting the same?
6
+ >
7
+ > Surely it doesn't need to be said anymore, but I *still* am.
8
+ > What's happening with this?
9
+
10
+ Yep, me too, although I bet due to RubyConf/OOPSLA, it may be a little
11
+ longer yet...
12
+
13
+ --
14
+ Eric Hodel - drbrain@segment7.net - http://segment7.net
15
+ All messages signed with fingerprint:
16
+ FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
@@ -0,0 +1,38 @@
1
+ On 15 May 2017 19:32, "Nomadic Sprite" <nomadic.sprite01@gmail.com> wrote:
2
+
3
+ The intent was to return nil when the first value was nil.
4
+ That was the op's issue.
5
+ If one of the values was nil, she/he wanted nil.
6
+
7
+ Nil && anything_else will always return nil, and I will not evaluate the
8
+ second clause.
9
+
10
+ On 8 May 2017 6:51 pm, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
11
+
12
+ > >>>>>>>>
13
+ > It should be:
14
+ > 2.0 && 2.0 + 12.0
15
+ > <<<<<<<<<
16
+ >
17
+ > Ah! Yes, that works.
18
+ >
19
+ >
20
+ People are intent on not understanding, aren't they.
21
+
22
+ def nil_add_12 f
23
+ f && f + 12.0
24
+ end
25
+
26
+ Generalised to two parameters:
27
+
28
+ def nil_add a, b
29
+ a && b && a + b
30
+ end
31
+
32
+ The only quirk is the way they handle `false`.
33
+
34
+ This is not tested, but it may be possible to do this, too:
35
+
36
+ f&.+ b
37
+
38
+ Cheers
@@ -0,0 +1,7 @@
1
+ On 8 May 2017 17:34, "Andy Jones" <Andy.Jones@jameshall.co.uk> wrote:
2
+
3
+ nil && 2.0 + 12.0
4
+
5
+ It should be:
6
+
7
+ 2.0 && 2.0 + 12.0
@@ -0,0 +1,13 @@
1
+ I had a really hard time with the official guide, so when I finally
2
+ figured it out, I wrote one of my own:
3
+
4
+
5
+ http://ryanlue.com/posts/2017-02-18-how-to-publish-a-gem
6
+
7
+
8
+
9
+ Let me know if you like it (or if you don't) – any feedback is highly
10
+ appreciated!
11
+
12
+
13
+ —Ryan
@@ -4,16 +4,16 @@ the page.
4
4
 
5
5
  2013/7/20 sam via Discourse Meta <info@discourse.org>
6
6
 
7
- > sam replied to your post in 'Unable to create group' on Discourse Meta:
8
- > ------------------------------
9
- >
10
- > Is this an error handling thing, if you name the group "test" and only
11
- > place yourself in it, does it persist?
12
- > ------------------------------
13
- >
14
- > To respond, reply to this email or visit
15
- > http://meta.discourse.org/t/unable-to-create-group/8198/6 in your browser.
16
- >
17
- > To unsubscribe from these emails, visit your user preferences<http://meta.discourse.org/user_preferences>
18
- > .
19
- >
7
+ | sam replied to your post in 'Unable to create group' on Discourse Meta:
8
+ | ------------------------------
9
+ |
10
+ | Is this an error handling thing, if you name the group "test" and only
11
+ | place yourself in it, does it persist?
12
+ | ------------------------------
13
+ |
14
+ | To respond, reply to this email or visit
15
+ | http://meta.discourse.org/t/unable-to-create-group/8198/6 in your browser.
16
+ |
17
+ | To unsubscribe from these emails, visit your user preferences<http://meta.discourse.org/user_preferences>
18
+ | .
19
+ |
@@ -10,10 +10,10 @@ after the
10
10
 
11
11
  embedded email.
12
12
 
13
- >
14
- > This is another part of the embedded email.
15
- >
16
- >
13
+ C>
14
+ C> This is another part of the embedded email.
15
+ C>
16
+ C>
17
17
 
18
18
 
19
19
  _______________________
@@ -0,0 +1,7 @@
1
+ Hi Erlend Sogge Heggen,
2
+ Thank you for your reply.
3
+
4
+ > 在 2016年12月12日,下午8:45,Erlend Sogge Heggen <meta@discoursemail.com> 写道:
5
+ > fu.zhang:
6
+ > Some random question
7
+ >
@@ -0,0 +1,18 @@
1
+
2
+ Hi there! I am replying from my german Google Inbox.
3
+
4
+ Max Mustermann <try_discourse@discoursemail.com> schrieb am Fr., 28.
5
+ Apr. 2017 um 11:53 Uhr:
6
+
7
+ > max_2 <http://try.discourse.org/u/cfstras_2>
8
+ > April 28
9
+
10
+ > Hi there! you should be getting a mail.
11
+ > ------------------------------
12
+
13
+ > Visit Topic <http://try.discourse.org/t/this-is-my-internal-test/716/2>
14
+ > or reply to this email to respond.
15
+
16
+ > To unsubscribe from these emails, click here
17
+ > <http://try.discourse.org/email/unsubscribe/badf00d>
18
+ > .
@@ -0,0 +1,23 @@
1
+ Okay. Will give it a whirl.
2
+
3
+ Erlend Sogge Heggen <meta@discoursemail.com> schrieb am Di., 16. Aug. 2016
4
+ um 12:52 Uhr:
5
+
6
+ > erlend_sh <https://meta.discourse.org/users/erlend_sh> Erlend Sogge Heggen
7
+ > <https://meta.discourse.org/users/erlend_sh> team
8
+ > August 16
9
+ >
10
+ > Hi Bob,
11
+ >
12
+ > Sure, it sounds like your requirements would fit our Standard plan. I
13
+ > suggest you sign up for a free trial, as that will be the best way to see
14
+ > for yourself if we support the kind of custom styling
15
+ >
16
+ > Sincerely,
17
+ >
18
+ > Erlend
19
+ >
20
+ --
21
+ Viele Grüße / Best regards
22
+
23
+ Bob