middleman-protect-emails 0.1.0 → 0.2.0
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 +4 -4
- data/.travis.yml +0 -2
- data/Gemfile +0 -1
- data/README.md +3 -11
- data/Rakefile +2 -4
- data/features/extension.feature +6 -1
- data/fixtures/test-app/source/with_url_params.html +1 -0
- data/lib/middleman-protect-emails/extension.rb +1 -1
- data/lib/middleman-protect-emails/version.rb +1 -1
- data/middleman-protect-emails.gemspec +0 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec6e78ad8782e6973ec3d1bef178383bf63c6ce
|
4
|
+
data.tar.gz: 6cec3655ebdb89cd202e67b77ef79f71fbfd79b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6538b7dc73a782f2f206172e92283159ef6d30f244a5eaf9baf29ca1c2e026ac97a9dbd1981eb22f2126ec49c23c5572ed009457c8662b16522991721edadb2
|
7
|
+
data.tar.gz: 5c4f670130356e469b670253755ccf0109ee41e7cfd886cd7713505c77d2d6ca8bb7e9876b7dad59b1c618a0d1f94325ef01750569203aedd59de9872d431ec0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,23 +20,15 @@ And then run:
|
|
20
20
|
|
21
21
|
$ bundle
|
22
22
|
|
23
|
-
##
|
23
|
+
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Using this gem is as simple as adding the following line to your project's `config.rb` file:
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
# config.rb
|
29
28
|
activate :protect_emails
|
30
29
|
```
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
```ruby
|
35
|
-
# config.rb
|
36
|
-
configure :build do
|
37
|
-
activate :protect_emails
|
38
|
-
end
|
39
|
-
```
|
31
|
+
And that's it! This will now protect all `mailto` links in your Middleman project.
|
40
32
|
|
41
33
|
## Contributing
|
42
34
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'cucumber/rake/task'
|
3
|
-
require 'rake/clean'
|
4
3
|
|
5
4
|
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
6
|
-
t.cucumber_opts = "--color --
|
5
|
+
t.cucumber_opts = "--color --format progress"
|
7
6
|
end
|
8
7
|
|
9
|
-
task
|
10
|
-
task default: :test
|
8
|
+
task default: :cucumber
|
data/features/extension.feature
CHANGED
@@ -24,8 +24,13 @@ Feature: Email Protection
|
|
24
24
|
When I go to "/with_no_email.html"
|
25
25
|
Then I should not see "</script>"
|
26
26
|
|
27
|
-
Scenario:
|
27
|
+
Scenario: Encrypts multiple emails
|
28
28
|
Given the Server is running at "test-app"
|
29
29
|
When I go to "/with_multiple_emails.html"
|
30
30
|
Then I should see "<a href='#email-protection-rznvy1@rknzcyr.pbz'></a>"
|
31
31
|
Then I should see "<a href='#email-protection-rznvy2@rknzcyr.pbz'></a>"
|
32
|
+
|
33
|
+
Scenario: Encrypts mailto link parameters
|
34
|
+
Given the Server is running at "test-app"
|
35
|
+
When I go to "/with_url_params.html"
|
36
|
+
Then I should see "<a href='#email-protection-rznvy@rknzcyr.pbz?fhowrpg=Grfg%20Fhowrpg&obql=Grfg%20Obql'></a>"
|
@@ -0,0 +1 @@
|
|
1
|
+
<html><head></head><body><a href='mailto:email@example.com?subject=Test%20Subject&body=Test%20Body'></a></body></html>
|
@@ -41,7 +41,7 @@ class Middleman::ProtectEmailsExtension < ::Middleman::Extension
|
|
41
41
|
|
42
42
|
# Replaces mailto links with ROT13 equivalent
|
43
43
|
# TODO: Don't replace plaintext mailto links
|
44
|
-
new_content = body.gsub /mailto:([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})/i do
|
44
|
+
new_content = body.gsub /mailto:([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}(\?[A-Z0-9_\-&=%# ]*)?)/i do
|
45
45
|
replaced_email = true
|
46
46
|
email = $1.tr 'A-Za-z','N-ZA-Mn-za-m'
|
47
47
|
"#email-protection-#{email}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-protect-emails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ankit Sardesai
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: Middleman extension for email link protection and obfuscation.
|
56
42
|
email:
|
57
43
|
- amsardesai@gmail.com
|
@@ -72,6 +58,7 @@ files:
|
|
72
58
|
- fixtures/test-app/source/with_body.html
|
73
59
|
- fixtures/test-app/source/with_multiple_emails.html
|
74
60
|
- fixtures/test-app/source/with_no_email.html
|
61
|
+
- fixtures/test-app/source/with_url_params.html
|
75
62
|
- lib/middleman-protect-emails.rb
|
76
63
|
- lib/middleman-protect-emails/extension.rb
|
77
64
|
- lib/middleman-protect-emails/rot13_script.html
|
@@ -97,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
84
|
version: '0'
|
98
85
|
requirements: []
|
99
86
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.4.
|
87
|
+
rubygems_version: 2.4.3
|
101
88
|
signing_key:
|
102
89
|
specification_version: 4
|
103
90
|
summary: Middleman extension for email link protection and obfuscation
|