spamspanify 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +13 -1
- data/lib/spamspanify/version.rb +1 -1
- data/lib/spamspanify.rb +2 -1
- data/spamspanify.gemspec +2 -2
- data/spec/spamspanify_spec.rb +6 -0
- metadata +18 -26
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 95b386287edfeb22b32c1e6beb0121a40672aeab
|
4
|
+
data.tar.gz: b7deffab3beeb8da5507827e9bb595ae5e2311a5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0a87141ba8ce35091b0185a0375caec6e0b17b57131719899449e5d09482311a3e07649fad5a9f7c2698a0a527f400406c8b9cb7c1fc77742b0330831ba802a3
|
7
|
+
data.tar.gz: 3c72f1f27af88f3de6ff2fb6c1e81e4373655e8cff96649124bf1a4141beac53a998b52e4937a05dfda385565ee5d23988273beeac865dba30dccb9f56d4ed48
|
data/README.md
CHANGED
@@ -25,7 +25,19 @@ Or install it yourself as:
|
|
25
25
|
|
26
26
|
## Usage
|
27
27
|
|
28
|
-
Simply call the
|
28
|
+
Simply call the spamspanify method on a string:
|
29
|
+
|
30
|
+
text = "Feel free to <a href='mailto:info@example.com'>send us an email</a>"
|
31
|
+
|
32
|
+
# Default paranoia level (1):
|
33
|
+
text.spamspanify
|
34
|
+
# => "Feel free to <span class='spamspan'><span class='u'>info</span>@<span class='d'>example.com</span>(<span class='t'>send us an email</span>)</span>"
|
35
|
+
|
36
|
+
# Paranoia level 3:
|
37
|
+
text.spamspanify(3)
|
38
|
+
# => "Feel free to <span class='spamspan'><span class='u'>info</span> [at] <span class='d'>example [dot] com</span>(<span class='t'>send us an email</span>)</span>"
|
39
|
+
|
40
|
+
|
29
41
|
|
30
42
|
## Contributing
|
31
43
|
|
data/lib/spamspanify/version.rb
CHANGED
data/lib/spamspanify.rb
CHANGED
@@ -3,7 +3,8 @@ require "spamspanify/core_ext/string"
|
|
3
3
|
require "spamspanify/exceptions"
|
4
4
|
|
5
5
|
module Spamspanify
|
6
|
-
EMAIL_REGEXP
|
6
|
+
# TODO split EMAIL_REGEXP in separate local and domain parts
|
7
|
+
EMAIL_REGEXP = /([\w|&|\-\.])+@([\w|\-\.])+\w+/
|
7
8
|
MAILTO_REGEXP = /<a\s*href=(\'|\")mailto:#{ EMAIL_REGEXP }(\'|\").*<\/a>/
|
8
9
|
|
9
10
|
module_function
|
data/spamspanify.gemspec
CHANGED
@@ -7,14 +7,14 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.name = "spamspanify"
|
8
8
|
gem.version = Spamspanify::VERSION
|
9
9
|
gem.authors = ["Corné Verbruggen"]
|
10
|
-
gem.email = ["
|
10
|
+
gem.email = ["info@corneverbruggen.com"]
|
11
11
|
gem.description = %q{
|
12
12
|
Spamspanify extends the String class with a spamspanify method that
|
13
13
|
replaces all email addresses in a string with HTML markup that can be
|
14
14
|
handled by the SpamSpan javascript library.
|
15
15
|
}
|
16
16
|
gem.summary = "Transforms email addresses in a string into SpamSpam markup"
|
17
|
-
gem.homepage = "https://github.com/
|
17
|
+
gem.homepage = "https://github.com/corneverbruggen/spamspanify"
|
18
18
|
|
19
19
|
gem.files = `git ls-files`.split($/)
|
20
20
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/spec/spamspanify_spec.rb
CHANGED
@@ -20,6 +20,12 @@ describe Spamspanify do
|
|
20
20
|
"'u'>major.seven</span>@<span class='d'>a-flat.com</span></span>."
|
21
21
|
end
|
22
22
|
|
23
|
+
it "allows an ampersand in the local part of an email address" do
|
24
|
+
s = "Email major&minor.seven@a-flat.com."
|
25
|
+
expect(s.spamspanify).to eq "Email <span class='spamspan'><span class="\
|
26
|
+
"'u'>major&minor.seven</span>@<span class='d'>a-flat.com</span></span>."
|
27
|
+
end
|
28
|
+
|
23
29
|
describe "should transform html <a href='mailto:..> links as well" do
|
24
30
|
it "when link text is email address" do
|
25
31
|
s = "Email <a href='mailto:b.flat@minor.com'>b.flat@minor.com</a> please."
|
metadata
CHANGED
@@ -1,75 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spamspanify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Corné Verbruggen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '2.12'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '2.12'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: yard
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 0.8.3
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 0.8.3
|
62
|
-
description:
|
55
|
+
description: "\n Spamspanify extends the String class with a spamspanify method
|
63
56
|
that\n replaces all email addresses in a string with HTML markup that can be\n
|
64
57
|
\ handled by the SpamSpan javascript library.\n "
|
65
58
|
email:
|
66
|
-
-
|
59
|
+
- info@corneverbruggen.com
|
67
60
|
executables: []
|
68
61
|
extensions: []
|
69
62
|
extra_rdoc_files: []
|
70
63
|
files:
|
71
|
-
- .gitignore
|
72
|
-
- .rspec
|
64
|
+
- ".gitignore"
|
65
|
+
- ".rspec"
|
73
66
|
- Gemfile
|
74
67
|
- LICENSE.txt
|
75
68
|
- README.md
|
@@ -81,29 +74,28 @@ files:
|
|
81
74
|
- spamspanify.gemspec
|
82
75
|
- spec/spamspanify_spec.rb
|
83
76
|
- spec/spec_helper.rb
|
84
|
-
homepage: https://github.com/
|
77
|
+
homepage: https://github.com/corneverbruggen/spamspanify
|
85
78
|
licenses: []
|
79
|
+
metadata: {}
|
86
80
|
post_install_message:
|
87
81
|
rdoc_options: []
|
88
82
|
require_paths:
|
89
83
|
- lib
|
90
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
85
|
requirements:
|
93
|
-
- -
|
86
|
+
- - ">="
|
94
87
|
- !ruby/object:Gem::Version
|
95
88
|
version: '0'
|
96
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
90
|
requirements:
|
99
|
-
- -
|
91
|
+
- - ">="
|
100
92
|
- !ruby/object:Gem::Version
|
101
93
|
version: '0'
|
102
94
|
requirements: []
|
103
95
|
rubyforge_project:
|
104
|
-
rubygems_version:
|
96
|
+
rubygems_version: 2.4.8
|
105
97
|
signing_key:
|
106
|
-
specification_version:
|
98
|
+
specification_version: 4
|
107
99
|
summary: Transforms email addresses in a string into SpamSpam markup
|
108
100
|
test_files:
|
109
101
|
- spec/spamspanify_spec.rb
|