jekyll-email-protect 1.0.3 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ab0fa5d76b825e289fd358b8605ab0346b7f8e9
4
- data.tar.gz: 52afe5cafc58ddb1ac4b8d156e8c95562b35ec14
3
+ metadata.gz: 9816165b1479cc93ec01c54ad45b83535576f3a0
4
+ data.tar.gz: 5f2cb1e37e3dc4c6489092128e19c5f3a95cbea4
5
5
  SHA512:
6
- metadata.gz: 2c44c99a8cf5e9d00b922c3d0645df3e0a579f3c4417d0c7d5f64e44e576f917410b47fc5223d66d45265dca87974bbd6f0ef4ff93785912189b6fad593f5d89
7
- data.tar.gz: 4b0530049c23f1be1eaa671751fd64c11f051cd5401623d617747e031cd2040dc5415268e7a2b237d903bf1c029609f26b112c19f78b5d3e3879b07aff88cd83
6
+ metadata.gz: a4804c355182c8c72a1ac21d1ab31ba26a59aea8d6e2284fbe5d9da29d9f2d029e4dbdd08ed821f3d4eaf72bda13ab3e47167dd3430c56880339808b24bf0acb
7
+ data.tar.gz: 6262d6d5e4b7f40b0460dd356d79e31d5523cc5f7b10ae50c4474d54ed4e71d155be9aa9bac1ffe20e07e56343386bd5be35f290bc8a0adfc7582ec65d4fc46f
data/README.md CHANGED
@@ -25,13 +25,13 @@ $ gem install jekyll-email-protect
25
25
  After the plugin has been installed successfully, add the following lines to your `_config.yml` in order to tell Jekyll to use the plugin:
26
26
 
27
27
  ```
28
- gems:
28
+ plugins:
29
29
  - jekyll-email-protect
30
30
  ```
31
31
 
32
32
  ## Getting Started
33
33
 
34
- In your markup, simply use the `protect_email` liquid filter made available through this plugin:
34
+ In your markup, simply use the `encode_email` liquid filter made available through this plugin:
35
35
 
36
36
  ```
37
37
  {{ 'example@example.com' | encode_email }}
@@ -39,12 +39,18 @@ In your markup, simply use the `protect_email` liquid filter made available thro
39
39
 
40
40
  The above code will yield `%65%78%61%6D%70%6C%65@%65%78%61%6D%70%6C%65.%63%6F%6D`. Only use this filter within the `href` attribute of a given link.
41
41
 
42
+ You can also HTML-encode an email address with this plugin:
43
+
44
+ ```
45
+ {{ 'example@example.com' | html_encode_email }}
46
+ ```
47
+
42
48
  ## Example
43
49
 
44
50
  The following example shows how this plugin can be used to protect the `site`'s email address:
45
51
 
46
52
  ```
47
- <a href="mailto:{{ site.email | protect_email }}" title="Contact me">Contact me</a>
53
+ <a href="mailto:{{ site.email | encode_email }}">{{ site.email | html_encode_email }}</a>
48
54
  ```
49
55
 
50
56
  # Contribute
@@ -57,4 +63,4 @@ Copyright (c) 2015 Vincent Wochnik.
57
63
 
58
64
  License: MIT
59
65
 
60
- [ruby-gem]: https://rubygems.org/gems/jekyll-language-plugin
66
+ [ruby-gem]: https://rubygems.org/gems/jekyll-email-protect
@@ -4,7 +4,7 @@ module Jekyll
4
4
 
5
5
  # Percent-encode alphanumeric characters of an email address
6
6
  def encode_email(input)
7
- input.to_s.chars.inject("") do |result, char|
7
+ input.to_s.chars.inject(String.new) do |result, char|
8
8
  if char =~ /\p{Alnum}/
9
9
  char.bytes.inject(result) do |result, byte|
10
10
  result << '%%%02X' % byte
@@ -14,6 +14,15 @@ module Jekyll
14
14
  end
15
15
  end
16
16
  end
17
+
18
+ # HTML-encode characters of an email address
19
+ def html_encode_email(input)
20
+ input.to_s.chars.inject(String.new) do |result, char|
21
+ char.bytes.inject(result) do |result, byte|
22
+ result << '&#' + byte.to_s + ';'
23
+ end
24
+ end
25
+ end
17
26
  end
18
27
  end
19
28
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module EmailProtect
3
- VERSION = '1.0.3'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-email-protect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Wochnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-22 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.6'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
55
  description: Email protection liquid filter for Jekyll
@@ -59,11 +59,11 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - lib/jekyll/email-protect/version.rb
63
- - lib/jekyll/email-protect.rb
64
- - lib/jekyll-email-protect.rb
65
- - README.md
66
62
  - LICENSE.md
63
+ - README.md
64
+ - lib/jekyll-email-protect.rb
65
+ - lib/jekyll/email-protect.rb
66
+ - lib/jekyll/email-protect/version.rb
67
67
  - spec/protect_email_filter_spec.rb
68
68
  - spec/spec_helper.rb
69
69
  homepage: https://github.com/vwochnik/jekyll-email-protect
@@ -76,21 +76,21 @@ require_paths:
76
76
  - lib
77
77
  required_ruby_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: 1.9.3
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - '>='
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.0.14
89
+ rubygems_version: 2.5.1
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: This plugin provides a simple liquid filter which converts emails into percent-encoded
93
93
  strings.
94
94
  test_files:
95
- - spec/protect_email_filter_spec.rb
96
95
  - spec/spec_helper.rb
96
+ - spec/protect_email_filter_spec.rb