email_reply_trimmer 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/email_reply_trimmer.rb +17 -5
  3. data/lib/email_reply_trimmer/signature_matcher.rb +1 -1
  4. data/test/elided/delimiters.txt +0 -0
  5. data/test/elided/dual_embedded.txt +10 -0
  6. data/test/elided/email_headers_1.txt +12 -0
  7. data/test/elided/email_headers_2.txt +8 -0
  8. data/test/elided/email_headers_3.txt +15 -0
  9. data/test/elided/embedded_ception.txt +40 -0
  10. data/test/elided/embedded_email_1.txt +6 -0
  11. data/test/elided/embedded_email_10.txt +33 -0
  12. data/test/elided/embedded_email_2.txt +9 -0
  13. data/test/elided/embedded_email_3.txt +14 -0
  14. data/test/elided/embedded_email_4.txt +15 -0
  15. data/test/elided/embedded_email_5.txt +3 -0
  16. data/test/elided/embedded_email_6.txt +3 -0
  17. data/test/elided/embedded_email_7.txt +0 -0
  18. data/test/elided/embedded_email_8.txt +3 -0
  19. data/test/elided/embedded_email_9.txt +3 -0
  20. data/test/elided/embedded_email_dutch_1.txt +10 -0
  21. data/test/elided/embedded_email_dutch_2.txt +59 -0
  22. data/test/elided/embedded_email_french.txt +9 -0
  23. data/test/elided/embedded_email_german_1.txt +19 -0
  24. data/test/elided/embedded_email_german_2.txt +3 -0
  25. data/test/elided/embedded_email_german_3.txt +7 -0
  26. data/test/elided/embedded_email_polish.txt +29 -0
  27. data/test/elided/embedded_email_portuguese.txt +14 -0
  28. data/test/elided/embedded_email_quote_text.txt +0 -0
  29. data/test/elided/embedded_email_russian.txt +25 -0
  30. data/test/elided/embedded_email_spanish_1.txt +32 -0
  31. data/test/elided/embedded_email_spanish_2.txt +9 -0
  32. data/test/elided/forwarded_message.txt +0 -0
  33. data/test/elided/normalize_line_endings.txt +0 -0
  34. data/test/elided/quote_and_text.txt +0 -0
  35. data/test/elided/quote_only.txt +0 -0
  36. data/test/elided/retains_spaces_and_formatting.txt +0 -0
  37. data/test/elided/signatures.txt +0 -0
  38. data/test/elided/strip.txt +0 -0
  39. data/test/elided/text_only.txt +0 -0
  40. data/test/test_email_reply_trimmer.rb +21 -7
  41. data/test/{replies → trimmed}/delimiters.txt +0 -0
  42. data/test/{replies → trimmed}/dual_embedded.txt +0 -0
  43. data/test/{replies → trimmed}/email_headers_1.txt +0 -0
  44. data/test/{replies → trimmed}/email_headers_2.txt +0 -0
  45. data/test/{replies → trimmed}/email_headers_3.txt +0 -0
  46. data/test/{replies → trimmed}/embedded_ception.txt +0 -0
  47. data/test/{replies → trimmed}/embedded_email_1.txt +0 -0
  48. data/test/{replies → trimmed}/embedded_email_10.txt +0 -0
  49. data/test/{replies → trimmed}/embedded_email_2.txt +0 -0
  50. data/test/{replies → trimmed}/embedded_email_3.txt +0 -0
  51. data/test/{replies → trimmed}/embedded_email_4.txt +0 -0
  52. data/test/{replies → trimmed}/embedded_email_5.txt +0 -0
  53. data/test/{replies → trimmed}/embedded_email_6.txt +0 -0
  54. data/test/{replies → trimmed}/embedded_email_7.txt +0 -0
  55. data/test/{replies → trimmed}/embedded_email_8.txt +0 -0
  56. data/test/{replies → trimmed}/embedded_email_9.txt +0 -0
  57. data/test/{replies → trimmed}/embedded_email_dutch_1.txt +0 -0
  58. data/test/{replies → trimmed}/embedded_email_dutch_2.txt +0 -0
  59. data/test/{replies → trimmed}/embedded_email_french.txt +0 -0
  60. data/test/{replies → trimmed}/embedded_email_german_1.txt +0 -0
  61. data/test/{replies → trimmed}/embedded_email_german_2.txt +0 -0
  62. data/test/{replies → trimmed}/embedded_email_german_3.txt +0 -0
  63. data/test/{replies → trimmed}/embedded_email_polish.txt +0 -0
  64. data/test/{replies → trimmed}/embedded_email_portuguese.txt +0 -0
  65. data/test/{replies → trimmed}/embedded_email_quote_text.txt +0 -0
  66. data/test/{replies → trimmed}/embedded_email_russian.txt +0 -0
  67. data/test/{replies → trimmed}/embedded_email_spanish_1.txt +0 -0
  68. data/test/{replies → trimmed}/embedded_email_spanish_2.txt +0 -0
  69. data/test/{replies → trimmed}/forwarded_message.txt +0 -0
  70. data/test/{replies → trimmed}/normalize_line_endings.txt +0 -0
  71. data/test/{replies → trimmed}/quote_and_text.txt +0 -0
  72. data/test/{replies → trimmed}/quote_only.txt +0 -0
  73. data/test/{replies → trimmed}/retains_spaces_and_formatting.txt +0 -0
  74. data/test/{replies → trimmed}/signatures.txt +0 -0
  75. data/test/{replies → trimmed}/strip.txt +0 -0
  76. data/test/{replies → trimmed}/text_only.txt +0 -0
  77. metadata +74 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4b7111f3d85ec48027ab149ec317f811e54edb7
4
- data.tar.gz: 4187af3b8da111b6e695b87f675999ea262a612a
3
+ metadata.gz: aa26c45ca9b02dd9612f9873b0b038b01097fab5
4
+ data.tar.gz: dc7d111a4fc6df8fdadcb1396b91562bde0eca91
5
5
  SHA512:
6
- metadata.gz: 828510391511ccbd47acfb11ea91cfd7693d2bc600b3e69791ee62c80d3d8e9e2bd6d88fd576e69f22047d8ce7a9b7f09e980e6574eeed38108f1df2bf8df190
7
- data.tar.gz: 45498e31054c288dac4b1e099abbd8916848f3640c87ef197a7f0460698b7471c0ec8a8b3535b16ce045c5e4e8cca6000e9883d854e48ace84da5278418e10ba
6
+ metadata.gz: b814ea966bad138479564a2f84348ab557521a25b6b1066b9d30798fcf48d3c8e9c1a628a04ce68d03354997d68118f7c7ab36d658f548729937a8e1a9fcd1f3
7
+ data.tar.gz: 6475b84f64405e4f476719c81f330bf93341bd1fd302f265c840cef37218783eb1e4b55b9c2a25de47012ca813063962f48b3a91cdf5f6b33ada82a8b07d1d48
@@ -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.0.8"
9
+ VERSION = "0.1.0"
10
10
 
11
11
  DELIMITER = "d"
12
12
  EMBEDDED = "b"
@@ -26,7 +26,7 @@ class EmailReplyTrimmer
26
26
  return TEXT
27
27
  end
28
28
 
29
- def self.trim(text)
29
+ def self.trim(text, split=false)
30
30
  return "" if text.nil? || text =~ /\A[[:space:]]*\Z/m
31
31
 
32
32
  # normalize line endings
@@ -38,6 +38,8 @@ class EmailReplyTrimmer
38
38
  text.gsub!($1, $1.gsub(/\n[[:space:]>\-]*/, " "))
39
39
  end
40
40
 
41
+ removed = []
42
+
41
43
  # from now on, we'll work on a line-by-line basis
42
44
  lines = text.split("\n")
43
45
 
@@ -55,6 +57,7 @@ class EmailReplyTrimmer
55
57
  # then take everything up to that marker
56
58
  if pattern =~ /te*b[^q]*$/
57
59
  index = pattern =~ /te*b[^q]*$/
60
+ removed = lines[(index + 1)..-1]
58
61
  pattern = pattern[0..index]
59
62
  lines = lines[0..index]
60
63
  end
@@ -63,11 +66,12 @@ class EmailReplyTrimmer
63
66
  # then take everything up to that marker
64
67
  if pattern =~ /te*b[eqbh]*[te]*$/
65
68
  index = pattern =~ /te*b[eqbh]*[te]*$/
69
+ removed = lines[(index + 1)..-1]
66
70
  pattern = pattern[0..index]
67
71
  lines = lines[0..index]
68
72
  end
69
73
 
70
- # if there still are some embedded email markers, just empty them
74
+ # if there still are some embedded email markers, just remove them
71
75
  while pattern =~ /b/
72
76
  index = pattern =~ /b/
73
77
  pattern[index] = "e"
@@ -85,6 +89,7 @@ class EmailReplyTrimmer
85
89
  # these headers
86
90
  if pattern =~ /t[eq]*h{3,}/
87
91
  index = pattern =~ /t[eq]*h{3,}/
92
+ removed = lines[(index + 1)..-1]
88
93
  pattern = pattern[0..index]
89
94
  lines = lines[0..index]
90
95
  end
@@ -103,8 +108,15 @@ class EmailReplyTrimmer
103
108
  lines = lines[0...index]
104
109
  end
105
110
 
106
- # result
107
- lines.join("\n").strip
111
+ # results
112
+ trimmed = lines.join("\n").strip
113
+ elided = removed.join("\n").strip
114
+
115
+ if split
116
+ [trimmed, elided]
117
+ else
118
+ trimmed
119
+ end
108
120
  end
109
121
 
110
122
  end
@@ -25,7 +25,7 @@ class SignatureMatcher
25
25
  # French
26
26
  /^[[:space:]]*Envoyé depuis mon .+/i,
27
27
  # German
28
- /^[[:space:]]*Von meinem Mobilgerät gesendet/i,
28
+ /^[[:space:]]*Von meinem .+ gesendet/i,
29
29
  /^[[:space:]]*Diese Nachricht wurde von .+ gesendet/i,
30
30
  ]
31
31
 
File without changes
@@ -0,0 +1,10 @@
1
+ On Mon, Feb 1, 2016 at 4:58 AM -0800, "Some One" <foo@bar.com> wrote:
2
+
3
+
4
+ This is the 2nd email.
5
+
6
+
7
+ On Sun, Jan 31, 2016 at 9:58 PM -0800, "Another One" <info@discourse.org> wrote:
8
+
9
+
10
+ This is the 1st email.
@@ -0,0 +1,12 @@
1
+ *From:* Outlook user
2
+ *Sent:* 2016-01-27
3
+ *To:* info@discourse.org
4
+ *Subject:* Are you using Outlook?
5
+
6
+
7
+
8
+ Just some random text wich is part
9
+
10
+ of the embedded email...
11
+
12
+ Outlook user
@@ -0,0 +1,8 @@
1
+ From: Discourse <info@discourse.org.
2
+ Sent: Thursday, 28 January 2016 8:16 p.m.
3
+ To: Someone
4
+ Subject: (no subject)
5
+
6
+ Lorem ipsum.
7
+
8
+ Ipsor dolor sum met.
@@ -0,0 +1,15 @@
1
+ From: Some One <discuss@foo.bar<mailto:discuss@foo.bar>>
2
+ Reply-To: "For.bar" <reply+275e18486b01289e3250bebe85ef6496@members.foo.bar<mailto:reply+275e18486b01289e3250bebe85ef6496@members.foo.bar>>
3
+ Date: Monday, February 8, 2016 11:44 AM
4
+ To: Discourse <discourse@discourse.org<mailto:discourse@discourse.org>>
5
+ Subject: VIS
6
+
7
+
8
+ Here's an email with some very important stuff.
9
+
10
+
11
+ Reply here<http://foo.bar> or hit reply from your inbox to help members by sharing your ideas.
12
+ Mute this topic<http://42.wat> to stop getting updates, we'll send you the next one.
13
+
14
+
15
+ DO NOT FORWARD THIS EMAIL!
@@ -0,0 +1,40 @@
1
+ On Mon, Feb 1, 2016 at 6:32 PM, Jeff Atwood <info@discourse.org> wrote:
2
+
3
+ > This is Jeff's reply.
4
+ >
5
+ > On Mon, Feb 1, 2016 at 7:50 AM, Some One <foo@bar.com
6
+ > > wrote:
7
+ >
8
+ >> Great!
9
+ >>
10
+ >> Many thanks.
11
+ >>
12
+ >> ~s
13
+ >>
14
+ >> On Mon, Feb 1, 2016 at 5:05 AM Discourse Team <team@discourse.org> wrote:
15
+ >>
16
+ >>> WAT?
17
+ >>>
18
+ >>> On Wed, Jan 27, 2016 at 10:48 PM, Some One <
19
+ >>> foo@bar.com> wrote:
20
+ >>>
21
+ >>>> Hi Team,
22
+ >>>>
23
+ >>>> How is it doing?
24
+ >>>>
25
+ >>>> Some One
26
+ >>>>
27
+ >>>> On Wed, Jan 27, 2016 at 10:10 AM Discourse Team <team@discourse.org>
28
+ >>>> wrote:
29
+ >>>>
30
+ >>>>> Hello :waves_hand:
31
+ >>>>>
32
+ >>>>
33
+ >>>
34
+ >
35
+
36
+
37
+ Some One
38
+ Community Manager
39
+ foo@bar.com
40
+ (123) 456-7890
@@ -0,0 +1,6 @@
1
+ On Wed, Sep 25, 2013, at 03:57 PM, richard_clark wrote:
2
+
3
+ > This is the embedded email
4
+
5
+ This is after the embedded email and will not show up because 99% of the times
6
+ this is the signature...
@@ -0,0 +1,33 @@
1
+ On Sun, Feb 7, 2016 at 12:12 AM -0800, "Arpit Jalan" <arpit.jalan@discourse.org<mailto:arpit.jalan@discourse.org>> wrote:
2
+
3
+ Hi Some,
4
+
5
+ https://meta.discourse.org is now running on latest Discourse version!
6
+
7
+ Regards,
8
+ Arpit
9
+
10
+ On Fri, Feb 5, 2016 at 10:43 AM Arpit Jalan <arpit.jalan@discourse.org<mailto:arpit.jalan@discourse.org>> wrote:
11
+ Okay, sure!
12
+
13
+ Arpit
14
+ On Fri, 5 Feb 2016 at 10:42, Some One <foo@bar.com<mailto:foo@bar.com>> wrote:
15
+ Arpit,
16
+ Yes that sounds good.
17
+
18
+
19
+ From: Arpit Jalan <arpit.jalan@discourse.org<mailto:arpit.jalan@discourse.org>>
20
+ Sent: Thursday, February 4, 2016 10:05 AM
21
+ Subject: Meta Discourse update
22
+ To: Some One <foo@bar.com<mailto:foo@bar.com>>, Discourse Team <team@discourse.org<mailto:team@discourse.org>>
23
+
24
+
25
+
26
+ Hi Some One,
27
+
28
+ Time to update meta to the latest Discourse version!
29
+
30
+ Do you want me to take care of it?
31
+
32
+ Regards,
33
+ Arpit
@@ -0,0 +1,9 @@
1
+ ---- On Tue, 22 Dec 2015 14:17:36 +0530 Sam Saffron&lt;info@discourse.org&gt; wrote ----
2
+
3
+
4
+ sam Sam Saffron co-founder
5
+ December 22
6
+ You are not using the right endpoint, go to user profile / badges, have a look at dev tools to see what it calls
7
+ There is a discrete endpoint to get all the badges a user has
8
+
9
+ To respond, reply to this email or visit the topic.
@@ -0,0 +1,14 @@
1
+ On Thu, Jun 20, 2013 at 4:18 PM, matt2 via Discourse Meta < info@discourse.org> wrote:
2
+
3
+ > matt2 posted in 'Discourse on Ubuntu: Video Walkthrough' on Discourse Meta:
4
+ > ------------------------------
5
+ >
6
+ > Has anyone tried on AWS? a public AMI would be awesome.
7
+ > ------------------------------
8
+ >
9
+ > Please visit this link to respond:
10
+ > http://meta.discourse.org/t/discourse-on-ubuntu-video-walkthrough/7478/4
11
+ >
12
+ > To unsubscribe from these emails, visit your user preferences<http://meta.discourse.org/user_preferences>
13
+ > .
14
+ >
@@ -0,0 +1,15 @@
1
+ 2013/7/20 sam via Discourse Meta <info@discourse.org>
2
+
3
+ > sam replied to your post in 'Unable to create group' on Discourse Meta:
4
+ > ------------------------------
5
+ >
6
+ > Is this an error handling thing, if you name the group "test" and only
7
+ > place yourself in it, does it persist?
8
+ > ------------------------------
9
+ >
10
+ > To respond, reply to this email or visit
11
+ > http://meta.discourse.org/t/unable-to-create-group/8198/6 in your browser.
12
+ >
13
+ > To unsubscribe from these emails, visit your user preferences<http://meta.discourse.org/user_preferences>
14
+ > .
15
+ >
@@ -0,0 +1,3 @@
1
+ Some One <info@discourse.org> wrote:
2
+
3
+ Something that will be considered as the embedded email.
@@ -0,0 +1,3 @@
1
+ On 28 Jan 2016, at 19:04, Some One wrote:
2
+
3
+ > Did you write something interesting?
File without changes
@@ -0,0 +1,3 @@
1
+ -------- Original Message --------
2
+
3
+ THE END.
@@ -0,0 +1,3 @@
1
+ *-------- Original Message --------*
2
+
3
+ THE END.
@@ -0,0 +1,10 @@
1
+ > Op 2 feb. 2015 om 05:28 heeft VannillaSky <info@discourse.org> het volgende geschreven:
2
+ >
3
+ >
4
+ > VannillaSky
5
+ > February 2
6
+ > Solved. Going forward...
7
+ >
8
+ > To respond, reply to this email or visit https://meta.discourse.org/t/import-posts-from-facebook-group-into-discourse/6089/33 in your browser.
9
+ >
10
+ > To unsubscribe from these emails, visit your user preferences.
@@ -0,0 +1,59 @@
1
+ Op 16 aug. 2014 05:13 schreef "codinghorror" <info@discourse.org> het volgende geschreven:
2
+
3
+ > codinghorror <https://meta.discourse.org/users/codinghorror>
4
+ > August 15
5
+ >
6
+ > Hmm, if that is true we need to fix that somehow.
7
+ >
8
+ > To respond, reply to this email or visit
9
+ > https://meta.discourse.org/t/configuring-google-oauth2-login-for-discourse/15858/38
10
+ > in your browser.
11
+ > ------------------------------
12
+ > Previous Replies elberet <https://meta.discourse.org/users/elberet>
13
+ > August 15
14
+ >
15
+ > Are you using an ad blocker? Adblock Plus, for instance, removes the login
16
+ > buttons.
17
+ > bwvanmanen <https://meta.discourse.org/users/bwvanmanen>
18
+ > August 15
19
+ >
20
+ > The 'Sign in with Google' button does appear when I try to log in from
21
+ > another pc. However the button does not appear on my pc using another
22
+ > browser.
23
+ > bwvanmanen <https://meta.discourse.org/users/bwvanmanen>
24
+ > August 15
25
+ >
26
+ > I followed the steps from the opening post, but I don't get a google login
27
+ > option when users try to log in. There is just the normal user/password,
28
+ > the word OR, and nothing next to that. Any clues?
29
+ >
30
+ > neil <https://meta.discourse.org/users/neil>
31
+ > August 1
32
+ >
33
+ > Glad you got it fixed. It's good to have the resolution in this topic too.
34
+ > I added a link to your topic in the first post.
35
+ > jgehrcke <https://meta.discourse.org/users/jgehrcke>
36
+ > July 31
37
+ >
38
+ > Sorry, that was kind of a cross-posting. Indeed, I got that fixed as you
39
+ > say, as reported here:
40
+ > jgehrcke said:
41
+ >
42
+ > I understand the solution you are proposing. The proper fix, without
43
+ > customizing the disource.conf in the container, however, would be to inform
44
+ > the web application about the protocol used via an HTTP header, as you are
45
+ > also suggesting. The question is: does Discourse respect/support
46
+ > X-Forwarded-Protocol? Then I can easily configure the nginx reverse proxy
47
+ > with proxy_set_header X-Forwarded-Protocol $scheme; Edit: I can confirm
48
+ > that properly setting the X-Forwarded-Proto header in the nginx …
49
+ >
50
+ > Thanks and sorry for not reporting back here!
51
+ > ------------------------------
52
+ >
53
+ > To respond, reply to this email or visit
54
+ > https://meta.discourse.org/t/configuring-google-oauth2-login-for-discourse/15858/38
55
+ > in your browser.
56
+ >
57
+ > To unsubscribe from these emails, visit your user preferences
58
+ > <https://meta.discourse.org/my/preferences>.
59
+ >
@@ -0,0 +1,9 @@
1
+ Le 4 janv. 2016 19:03, "Neil Lalonde" <info@discourse.org> a écrit :
2
+
3
+ > <https://meta.discourse.org/users/neil> team
4
+ > January 4
5
+ >
6
+ > Discourse c'est top !
7
+ >
8
+ > Neil
9
+ >
@@ -0,0 +1,19 @@
1
+ codinghorror via Discourse Meta <info@discourse.org> schrieb:
2
+ >codinghorror posted in 'Visually separate "Like it too" / "Undo like"'
3
+ >on Discourse Meta:
4
+ >
5
+ >---
6
+ >So turns out this is sort of a complex change for something so small.
7
+ >Our code at that location assumes all phrases end in periods. Changing
8
+ >that conditionally to sometimes an em-dash, sometimes not, is kind of..
9
+ >a pain in the butt.
10
+ >
11
+ >Will keep an eye on it, but low priority given the work required.
12
+ >
13
+ >---
14
+ >To respond, reply to this email or visit
15
+ >http://meta.discourse.org/t/visually-separate-like-it-too-undo-like/8464/3
16
+ >in your browser.
17
+ >
18
+ >To unsubscribe from these emails, visit your [user
19
+ >preferences](http://meta.discourse.org/user_preferences).
@@ -0,0 +1,3 @@
1
+ Am 03.02.2016 3:35 nachm. schrieb Max Mustermann <noreply@meta.discourse.org>:
2
+
3
+ > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@@ -0,0 +1,7 @@
1
+ -----Ursprüngliche Nachricht-----
2
+ Von: Discourse Team <team@discourse.org>
3
+ Gesendet: Don 11 Februar 2016 11:23
4
+ An: Some One <foo@bar.com>
5
+ Betreff: Some Subject
6
+
7
+ Hallo! Wie geht es Ihnen heute?
@@ -0,0 +1,29 @@
1
+ Dnia 14 lip 2015 o godz. 00:25 Michael Downey <info@discourse.org> napisał(a):
2
+
3
+ >
4
+ > downey Michael Downey Senior Tester
5
+ > July 13
6
+ > Sounds interesting. What is the license?
7
+ >
8
+ > To respond, reply to this email or visit https://meta.discourse.org/t/static-pages-plugin/31027/2 in your browser.
9
+ >
10
+ > Previous Replies
11
+ >
12
+ > hauleth
13
+ > July 13
14
+ > WIP
15
+ >
16
+ > Location: https://github.com/hauleth/low_voltage
17
+ >
18
+ > Authors: @hauleth
19
+ >
20
+ > Simple plugin to add "static" pages to Discourse instance. For now usage is kind of complicated at it needs to fetch static pages from app/views/pages. Ideas for future implements:
21
+ >
22
+ > Create DB model to hold pages
23
+ > Adding admin page that will allow editing that pages
24
+ > Custom styles for static pages
25
+ > Any help appreciated.
26
+ >
27
+ > To respond, reply to this email or visit https://meta.discourse.org/t/static-pages-plugin/31027/2 in your browser.
28
+ >
29
+ > To unsubscribe from these emails, visit your user preferences.
@@ -0,0 +1,14 @@
1
+ Em 2 de fevereiro de 2015 10:58, discourse < info@discourse.org> escreveu:
2
+
3
+ > discourse <https://meta.discourse.org/users/discourse>
4
+ > February 2
5
+ >
6
+ > Bom dia. Obrigado pela atenção
7
+ > ------------------------------
8
+ >
9
+ > To respond, reply to this email or visit
10
+ > https://meta.discourse.org/ in your browser.
11
+ >
12
+ > To unsubscribe from these emails, visit your user preferences
13
+ > <https://meta.discourse.org/my/preferences>.
14
+ >
File without changes
@@ -0,0 +1,25 @@
1
+ понедельник, 6 октября 2014 г. пользователь lidel написал:
2
+
3
+ > lidel <https://meta.discourse.org/users/lidel>
4
+ > October 6
5
+ > winterbox:
6
+ >
7
+ > Do you have any plan to make this plugin?
8
+ >
9
+ > discourse-locale-override
10
+ > <https://github.com/lidel/discourse-locale-override> is just a hack, and
11
+ > as @sam <https://meta.discourse.org/users/sam> pointed out, it only works
12
+ > if you update your instance via commandline. I created it to speed up my
13
+ > work on pl_PL translation only.
14
+ >
15
+ > I see there is a need for a proper plugin (this and other threads), but
16
+ > until such plugin appears this is a semi-working workaround.
17
+ > ------------------------------
18
+ >
19
+ > To respond, reply to this email or visit
20
+ > https://meta.discourse.org/t/use-custom-translation-file/13786/41 in your
21
+ > browser.
22
+ >
23
+ > To unsubscribe from these emails, visit your user preferences
24
+ > <https://meta.discourse.org/my/preferences>.
25
+ >
@@ -0,0 +1,32 @@
1
+ El jueves, 21 de noviembre de 2013, codinghorror escribió:
2
+
3
+ > codinghorror <http://meta.discourse.org/users/codinghorror>
4
+ > November 21
5
+ >
6
+ > How are you creating this user? Describe it step by step.
7
+ >
8
+ > To respond, reply to this email or visit
9
+ > http://meta.discourse.org/t/error-creating-new-users-pg-numericvalueoutofrange/11046/2in your browser.
10
+ > ------------------------------
11
+ > Previous Replies PabloC <http://meta.discourse.org/users/pabloc>
12
+ > November 21
13
+ >
14
+ > Hi guys,
15
+ >
16
+ > While I create a new user, I'm finding this error in the logs :
17
+ >
18
+ > Processing by UsersController#create as */*
19
+ > Parameters: {"name"=>"Ps4 Support Forum", "email"=>"pablocorral+ps4@gmail.com <javascript:_e({}, 'cvml', 'pablocorral%2Bps4@gmail.com');>", "username"=>"PS4SupportForum", "password_confirmation"=>"[FILTERED]", "challenge"=>"11a4ebe83d9b2a9e0d45bc50b457ee17"}
20
+ > PG::NumericValueOutOfRange: ERROR: value "2201945804" is out of range for type integer
21
+ >
22
+ > Any idea?
23
+ >
24
+ > Tks!
25
+ > ------------------------------
26
+ >
27
+ > To respond, reply to this email or visit
28
+ > http://meta.discourse.org/t/error-creating-new-users-pg-numericvalueoutofrange/11046/2in your browser.
29
+ >
30
+ > To unsubscribe from these emails, visit your user preferences<http://meta.discourse.org/user_preferences>
31
+ > .
32
+ >
@@ -0,0 +1,9 @@
1
+ -----Mensaje original-----
2
+ De: "Miguel" <foo@bar.es>
3
+ Enviado: =E2=80=8E16/=E2=80=8E02/=E2=80=8E2016 14:53
4
+ Para: "discourse" <discourse@discourse.org>
5
+ Asunto: [MP]Parser del email
6
+
7
+ Visita el tema o responde a este email para publicar.
8
+ Para no recibir m=C3=A1s notificaciones de este tema en particular, haz cli=
9
+ c aqu=C3=AD. Para darte de baja de estos emails, cambia tus preferencias
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,10 +4,12 @@ require "email_reply_trimmer"
4
4
  class TestEmailReplyTrimmer < Minitest::Unit::TestCase
5
5
 
6
6
  EMAILS = Dir["test/emails/*.txt"].map { |path| File.basename(path) }
7
- REPLIES = Dir["test/replies/*.txt"].map { |path| File.basename(path) }
7
+ TRIMMED = Dir["test/trimmed/*.txt"].map { |path| File.basename(path) }
8
+ ELIDED = Dir["test/elided/*.txt"].map { |path| File.basename(path) }
8
9
 
9
10
  def test_all_emails_have_a_matching_reply
10
- assert_equal EMAILS, REPLIES, "Files in /emails and /replies folders should match 1-to-1"
11
+ assert_equal EMAILS, TRIMMED, "Files in /emails and /trimmed folders should match 1-to-1."
12
+ assert_equal EMAILS, ELIDED, "Files in /emails and /elided folders should match 1-to-1."
11
13
  end
12
14
 
13
15
  def test_normalize_line_endings_email_has_windows_line_endings
@@ -17,17 +19,29 @@ class TestEmailReplyTrimmer < Minitest::Unit::TestCase
17
19
  EMAILS.each do |filename|
18
20
  name = File.basename(filename, ".txt")
19
21
  define_method("test_#{name}") do
20
- assert_equal trim(filename), reply(filename), "EMAIL: #{filename}"
22
+ assert_equal trim(filename), trimmed(filename), "[TRIMMED] EMAIL: #{filename}"
23
+ assert_equal elide(filename), elided(filename), "[ELIDED] EMAIL: #{filename}"
21
24
  end
22
25
  end
23
26
 
24
27
  def trim(filename)
25
- body = File.read("test/emails/#{filename}").strip
26
- EmailReplyTrimmer.trim(body)
28
+ EmailReplyTrimmer.trim(email(filename))
27
29
  end
28
30
 
29
- def reply(filename)
30
- File.read("test/replies/#{filename}").strip
31
+ def elide(filename)
32
+ EmailReplyTrimmer.trim(email(filename), true)[1]
33
+ end
34
+
35
+ def email(filename)
36
+ File.read("test/emails/#{filename}").strip
37
+ end
38
+
39
+ def trimmed(filename)
40
+ File.read("test/trimmed/#{filename}").strip
41
+ end
42
+
43
+ def elided(filename)
44
+ File.read("test/elided/#{filename}").strip
31
45
  end
32
46
 
33
47
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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.0.8
4
+ version: 0.1.0
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-02-18 00:00:00.000000000 Z
11
+ date: 2016-03-03 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.
@@ -29,6 +29,42 @@ files:
29
29
  - lib/email_reply_trimmer/empty_line_matcher.rb
30
30
  - lib/email_reply_trimmer/quote_matcher.rb
31
31
  - lib/email_reply_trimmer/signature_matcher.rb
32
+ - test/elided/delimiters.txt
33
+ - test/elided/dual_embedded.txt
34
+ - test/elided/email_headers_1.txt
35
+ - test/elided/email_headers_2.txt
36
+ - test/elided/email_headers_3.txt
37
+ - test/elided/embedded_ception.txt
38
+ - test/elided/embedded_email_1.txt
39
+ - test/elided/embedded_email_10.txt
40
+ - test/elided/embedded_email_2.txt
41
+ - test/elided/embedded_email_3.txt
42
+ - test/elided/embedded_email_4.txt
43
+ - test/elided/embedded_email_5.txt
44
+ - test/elided/embedded_email_6.txt
45
+ - test/elided/embedded_email_7.txt
46
+ - test/elided/embedded_email_8.txt
47
+ - test/elided/embedded_email_9.txt
48
+ - test/elided/embedded_email_dutch_1.txt
49
+ - test/elided/embedded_email_dutch_2.txt
50
+ - test/elided/embedded_email_french.txt
51
+ - test/elided/embedded_email_german_1.txt
52
+ - test/elided/embedded_email_german_2.txt
53
+ - test/elided/embedded_email_german_3.txt
54
+ - test/elided/embedded_email_polish.txt
55
+ - test/elided/embedded_email_portuguese.txt
56
+ - test/elided/embedded_email_quote_text.txt
57
+ - test/elided/embedded_email_russian.txt
58
+ - test/elided/embedded_email_spanish_1.txt
59
+ - test/elided/embedded_email_spanish_2.txt
60
+ - test/elided/forwarded_message.txt
61
+ - test/elided/normalize_line_endings.txt
62
+ - test/elided/quote_and_text.txt
63
+ - test/elided/quote_only.txt
64
+ - test/elided/retains_spaces_and_formatting.txt
65
+ - test/elided/signatures.txt
66
+ - test/elided/strip.txt
67
+ - test/elided/text_only.txt
32
68
  - test/emails/delimiters.txt
33
69
  - test/emails/dual_embedded.txt
34
70
  - test/emails/email_headers_1.txt
@@ -65,43 +101,43 @@ files:
65
101
  - test/emails/signatures.txt
66
102
  - test/emails/strip.txt
67
103
  - test/emails/text_only.txt
68
- - test/replies/delimiters.txt
69
- - test/replies/dual_embedded.txt
70
- - test/replies/email_headers_1.txt
71
- - test/replies/email_headers_2.txt
72
- - test/replies/email_headers_3.txt
73
- - test/replies/embedded_ception.txt
74
- - test/replies/embedded_email_1.txt
75
- - test/replies/embedded_email_10.txt
76
- - test/replies/embedded_email_2.txt
77
- - test/replies/embedded_email_3.txt
78
- - test/replies/embedded_email_4.txt
79
- - test/replies/embedded_email_5.txt
80
- - test/replies/embedded_email_6.txt
81
- - test/replies/embedded_email_7.txt
82
- - test/replies/embedded_email_8.txt
83
- - test/replies/embedded_email_9.txt
84
- - test/replies/embedded_email_dutch_1.txt
85
- - test/replies/embedded_email_dutch_2.txt
86
- - test/replies/embedded_email_french.txt
87
- - test/replies/embedded_email_german_1.txt
88
- - test/replies/embedded_email_german_2.txt
89
- - test/replies/embedded_email_german_3.txt
90
- - test/replies/embedded_email_polish.txt
91
- - test/replies/embedded_email_portuguese.txt
92
- - test/replies/embedded_email_quote_text.txt
93
- - test/replies/embedded_email_russian.txt
94
- - test/replies/embedded_email_spanish_1.txt
95
- - test/replies/embedded_email_spanish_2.txt
96
- - test/replies/forwarded_message.txt
97
- - test/replies/normalize_line_endings.txt
98
- - test/replies/quote_and_text.txt
99
- - test/replies/quote_only.txt
100
- - test/replies/retains_spaces_and_formatting.txt
101
- - test/replies/signatures.txt
102
- - test/replies/strip.txt
103
- - test/replies/text_only.txt
104
104
  - test/test_email_reply_trimmer.rb
105
+ - test/trimmed/delimiters.txt
106
+ - test/trimmed/dual_embedded.txt
107
+ - test/trimmed/email_headers_1.txt
108
+ - test/trimmed/email_headers_2.txt
109
+ - test/trimmed/email_headers_3.txt
110
+ - test/trimmed/embedded_ception.txt
111
+ - test/trimmed/embedded_email_1.txt
112
+ - test/trimmed/embedded_email_10.txt
113
+ - test/trimmed/embedded_email_2.txt
114
+ - test/trimmed/embedded_email_3.txt
115
+ - test/trimmed/embedded_email_4.txt
116
+ - test/trimmed/embedded_email_5.txt
117
+ - test/trimmed/embedded_email_6.txt
118
+ - test/trimmed/embedded_email_7.txt
119
+ - test/trimmed/embedded_email_8.txt
120
+ - test/trimmed/embedded_email_9.txt
121
+ - test/trimmed/embedded_email_dutch_1.txt
122
+ - test/trimmed/embedded_email_dutch_2.txt
123
+ - test/trimmed/embedded_email_french.txt
124
+ - test/trimmed/embedded_email_german_1.txt
125
+ - test/trimmed/embedded_email_german_2.txt
126
+ - test/trimmed/embedded_email_german_3.txt
127
+ - test/trimmed/embedded_email_polish.txt
128
+ - test/trimmed/embedded_email_portuguese.txt
129
+ - test/trimmed/embedded_email_quote_text.txt
130
+ - test/trimmed/embedded_email_russian.txt
131
+ - test/trimmed/embedded_email_spanish_1.txt
132
+ - test/trimmed/embedded_email_spanish_2.txt
133
+ - test/trimmed/forwarded_message.txt
134
+ - test/trimmed/normalize_line_endings.txt
135
+ - test/trimmed/quote_and_text.txt
136
+ - test/trimmed/quote_only.txt
137
+ - test/trimmed/retains_spaces_and_formatting.txt
138
+ - test/trimmed/signatures.txt
139
+ - test/trimmed/strip.txt
140
+ - test/trimmed/text_only.txt
105
141
  homepage: https://github.com/discourse/email_reply_trimmer
106
142
  licenses:
107
143
  - MIT