jekyll_href 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/jekyll_href.gemspec +1 -1
- data/lib/href_tag.rb +21 -1
- data/lib/jekyll_href/version.rb +1 -1
- metadata +17 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13925ae2b44abe077101e5302d6aee8a640cdf3c50dcb4a29c76e2c355dae039
|
4
|
+
data.tar.gz: cf41c3a1c8424fc3e3ba67ccf6f27238e71766c72ed7006442291d855a933c4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afa3c62bf2806362a3e52d6978a8ea9ad3b5eb21e5f685b5328c04c0e19728e680a58961bd0daac805fcfbef1f031e98c6de769b085c9c8e4f058a209793c325
|
7
|
+
data.tar.gz: ce210b8cecefb1282991e9f4cca6ca5f80e7d94b9738f875f4848e9c445e24744e57c5a93f099e83362ed6e10448a38499f1907b96a04ef402db63710589f2aa
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 1.2.4 / 2023-05-18
|
2
|
+
* When only a URI is provided, the plugin now generates the `http` scheme for IP4 & IP6 loopback addresses like
|
3
|
+
`localhost`, and `127.0.0.0`, as well as private IP4 addresses like 192.168.0.0 and 172.16.0.0;
|
4
|
+
otherwise it generates the `https` scheme.
|
5
|
+
|
1
6
|
## 1.2.3 / 2023-05-16
|
2
7
|
* Added `label` option.
|
3
8
|
|
data/jekyll_href.gemspec
CHANGED
@@ -28,9 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
spec.required_ruby_version = '>= 2.6.0'
|
30
30
|
spec.summary = "Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'."
|
31
|
-
spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
|
32
31
|
spec.version = JekyllHrefVersion::VERSION
|
33
32
|
|
33
|
+
spec.add_dependency 'ipaddress'
|
34
34
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
35
35
|
spec.add_dependency 'jekyll_all_collections', '~> 0.3.0', '>= 0.3.1'
|
36
36
|
spec.add_dependency 'jekyll_plugin_support', '~> 0.6.0', '>= 0.6.1'
|
data/lib/href_tag.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ipaddress'
|
1
2
|
require 'jekyll_all_collections'
|
2
3
|
require 'jekyll_plugin_logger'
|
3
4
|
require 'jekyll_plugin_support'
|
@@ -151,7 +152,13 @@ module HrefTag
|
|
151
152
|
text = linkk.gsub('/', '/­') if @shy
|
152
153
|
text = linkk.gsub('/', '/<wbr>') if @wbr
|
153
154
|
@text = "<code>#{text}</code>"
|
154
|
-
@link = linkk.start_with?('http')
|
155
|
+
@link = if linkk.start_with?('http')
|
156
|
+
linkk
|
157
|
+
elsif insecure_ip_address linkk
|
158
|
+
"http://#{linkk}"
|
159
|
+
else
|
160
|
+
"https://#{linkk}"
|
161
|
+
end
|
155
162
|
else
|
156
163
|
@link = if @shy
|
157
164
|
linkk.gsub('/', '/­')
|
@@ -210,6 +217,19 @@ module HrefTag
|
|
210
217
|
end
|
211
218
|
end
|
212
219
|
|
220
|
+
def insecure_ip_address(string)
|
221
|
+
return true if string.start_with? 'localhost'
|
222
|
+
|
223
|
+
return false unless IPAddress.valid? string
|
224
|
+
|
225
|
+
ip_address = IPAddress string
|
226
|
+
return true if ip_address.loopback? || ip_address.private?
|
227
|
+
rescue StandardError
|
228
|
+
false
|
229
|
+
ensure
|
230
|
+
false
|
231
|
+
end
|
232
|
+
|
213
233
|
# Replace names in plugin-vars with values
|
214
234
|
def replace_vars(text)
|
215
235
|
variables = @site.config['plugin-vars']
|
data/lib/jekyll_href/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_href
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ipaddress
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: jekyll
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,9 +133,5 @@ rubygems_version: 3.3.3
|
|
119
133
|
signing_key:
|
120
134
|
specification_version: 4
|
121
135
|
summary: Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'.
|
122
|
-
test_files:
|
123
|
-
- spec/hash_array_spec.rb
|
124
|
-
- spec/href_spec.rb
|
125
|
-
- spec/spec_helper.rb
|
126
|
-
- spec/status_persistence.txt
|
136
|
+
test_files: []
|
127
137
|
...
|