jekyll_href 1.2.3 → 1.2.5
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/.rubocop.yml +1 -1
- data/CHANGELOG.md +8 -0
- data/README.md +23 -9
- data/jekyll_href.gemspec +2 -2
- data/lib/href_tag.rb +26 -2
- data/lib/jekyll_href/version.rb +1 -1
- metadata +19 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071f512c7ac10e09846593c0ba16664176d94f4b231e2fb8c20d447671ebdafd
|
4
|
+
data.tar.gz: 8b2bc1abb6ef1ce60a45e47623cf258215c0e17d74aac15ab13eaa5a003aff1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f5ec5bdbaec6ea11245945dfa442725b99788e1229b2f2f38a2e6ed5881f8c67270b78d391fde9ec5a6df801ef2fdbbbf8cfba89bcab215eac7317ac9d5bef1
|
7
|
+
data.tar.gz: d0c075ec73231d74439cc4a804bd5fea1bb129ab4c018acb291c6aea531c633dd7f0c084c2ac361ba21b5fadbcaf7100a543fb019977f5d87927b36739c7bf95
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 1.2.5 / 2023-05-26
|
2
|
+
* Added `style` and `class` options.
|
3
|
+
|
4
|
+
## 1.2.4 / 2023-05-18
|
5
|
+
* When only a URI is provided, the plugin now generates the `http` scheme for IP4 & IP6 loopback addresses like
|
6
|
+
`localhost`, and `127.0.0.0`, as well as private IP4 addresses like 192.168.0.0 and 172.16.0.0;
|
7
|
+
otherwise it generates the `https` scheme.
|
8
|
+
|
1
9
|
## 1.2.3 / 2023-05-16
|
2
10
|
* Added `label` option.
|
3
11
|
|
data/README.md
CHANGED
@@ -82,6 +82,20 @@ To enforce the generation of this attribute, preface the link with the word `bla
|
|
82
82
|
The `blank` and `notarget` parameters are mutually exclusive.
|
83
83
|
If both are specified, `blank` prevails.
|
84
84
|
|
85
|
+
### `class`
|
86
|
+
This option allows CSS classes to be added to the HTML generated by the `href` tag.
|
87
|
+
It has no effect on the `href_summary` tag output.
|
88
|
+
|
89
|
+
For example:
|
90
|
+
|
91
|
+
```
|
92
|
+
{% href class='bg_yellow' https://mslinn.com click here %}
|
93
|
+
```
|
94
|
+
Expands to:
|
95
|
+
```
|
96
|
+
<a href="https://mslinn.com" class="bg_yellow" rel="nofollow" target="_blank">click here</a>
|
97
|
+
```
|
98
|
+
|
85
99
|
### `follow`
|
86
100
|
To suppress the `nofollow` attribute, preface the link with the word `follow`.
|
87
101
|
|
@@ -109,8 +123,8 @@ The `match` option looks through the pages collection for a URL with containing
|
|
109
123
|
|
110
124
|
|
111
125
|
### `shy`
|
112
|
-
`shy` is only applicable for syntax 3 (implicit URL).
|
113
|
-
This option causes displayed urls to have an
|
126
|
+
The `shy` keyword option is only applicable for syntax 3 (implicit URL).
|
127
|
+
This option causes displayed urls to have an [`&shy;`](https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens) inserted after each slash (/).
|
114
128
|
If both `shy` and `wbr` are specified, `wbr` prevails.
|
115
129
|
|
116
130
|
For example:
|
@@ -119,21 +133,21 @@ For example:
|
|
119
133
|
```
|
120
134
|
Expands to:
|
121
135
|
```
|
122
|
-
<a href="https://mslinn.com/path/to/page.html">mslinn.com/­path/­to/­page.html</a>
|
136
|
+
<a href="https://mslinn.com/path/to/page.html" rel="nofollow" target="_blank">mslinn.com/­path/­to/­page.html</a>
|
123
137
|
```
|
124
138
|
|
125
|
-
### `
|
126
|
-
|
127
|
-
|
128
|
-
If both `shy` and `wbr` are specified, `wbr` prevails.
|
139
|
+
### `style`
|
140
|
+
This option allows CSS styling to be added to the HTML generated by the `href` tag.
|
141
|
+
It has no effect on the `href_summary` tag output.
|
129
142
|
|
130
143
|
For example:
|
144
|
+
|
131
145
|
```
|
132
|
-
{% href
|
146
|
+
{% href style='color: red; font-weight: bold;' https://mslinn.com click here %}
|
133
147
|
```
|
134
148
|
Expands to:
|
135
149
|
```
|
136
|
-
<a href="https://mslinn.com
|
150
|
+
<a href="https://mslinn.com" rel="nofollow" style="color: ref; font-weight: bold" target="_blank">click here</a>
|
137
151
|
```
|
138
152
|
|
139
153
|
### `summary`
|
data/jekyll_href.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
END_OF_DESC
|
11
11
|
spec.email = ['mslinn@mslinn.com']
|
12
12
|
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
13
|
-
spec.homepage = 'https://www.mslinn.com/
|
13
|
+
spec.homepage = 'https://www.mslinn.com/jekyll_plugins/jekyll_href.html'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.metadata = {
|
16
16
|
'allowed_push_host' => 'https://rubygems.org',
|
@@ -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'
|
@@ -46,7 +47,9 @@ module HrefTag
|
|
46
47
|
globals_update(@helper.argv, linkk) # Sets @link and @text, might clear @follow and @target
|
47
48
|
handle_match if @match
|
48
49
|
save_summary
|
49
|
-
"
|
50
|
+
klass = " class='#{@klass}'" if @klass
|
51
|
+
style = " style='#{@style}'" if @style
|
52
|
+
"<a href='#{@link}'#{klass}#{style}#{@target}#{@follow}>#{@text}</a>"
|
50
53
|
end
|
51
54
|
|
52
55
|
private
|
@@ -121,11 +124,13 @@ module HrefTag
|
|
121
124
|
AllCollectionsHooks.compute(@site)
|
122
125
|
|
123
126
|
@blank = @helper.parameter_specified? 'blank'
|
127
|
+
@klass = @helper.parameter_specified? 'class'
|
124
128
|
@follow = @helper.parameter_specified?('follow') ? '' : " rel='nofollow'"
|
125
129
|
@match = @helper.parameter_specified? 'match'
|
126
130
|
@label = @helper.parameter_specified? 'label'
|
127
131
|
@summary_exclude = @helper.parameter_specified? 'summary_exclude'
|
128
132
|
@shy = @helper.parameter_specified? 'shy'
|
133
|
+
@style = @helper.parameter_specified? 'style'
|
129
134
|
@summary = @helper.parameter_specified? 'summary'
|
130
135
|
@target = @blank ? " target='_blank'" : nil
|
131
136
|
@target ||= @helper.parameter_specified?('notarget') ? '' : " target='_blank'"
|
@@ -151,7 +156,13 @@ module HrefTag
|
|
151
156
|
text = linkk.gsub('/', '/­') if @shy
|
152
157
|
text = linkk.gsub('/', '/<wbr>') if @wbr
|
153
158
|
@text = "<code>#{text}</code>"
|
154
|
-
@link = linkk.start_with?('http')
|
159
|
+
@link = if linkk.start_with?('http')
|
160
|
+
linkk
|
161
|
+
elsif insecure_ip_address linkk
|
162
|
+
"http://#{linkk}"
|
163
|
+
else
|
164
|
+
"https://#{linkk}"
|
165
|
+
end
|
155
166
|
else
|
156
167
|
@link = if @shy
|
157
168
|
linkk.gsub('/', '/­')
|
@@ -210,6 +221,19 @@ module HrefTag
|
|
210
221
|
end
|
211
222
|
end
|
212
223
|
|
224
|
+
def insecure_ip_address(string)
|
225
|
+
return true if string.start_with? 'localhost'
|
226
|
+
|
227
|
+
return false unless IPAddress.valid? string
|
228
|
+
|
229
|
+
ip_address = IPAddress string
|
230
|
+
return true if ip_address.loopback? || ip_address.private?
|
231
|
+
rescue StandardError
|
232
|
+
false
|
233
|
+
ensure
|
234
|
+
false
|
235
|
+
end
|
236
|
+
|
213
237
|
# Replace names in plugin-vars with values
|
214
238
|
def replace_vars(text)
|
215
239
|
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.5
|
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-26 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
|
@@ -88,14 +102,14 @@ files:
|
|
88
102
|
- spec/href_spec.rb
|
89
103
|
- spec/spec_helper.rb
|
90
104
|
- spec/status_persistence.txt
|
91
|
-
homepage: https://www.mslinn.com/
|
105
|
+
homepage: https://www.mslinn.com/jekyll_plugins/jekyll_href.html
|
92
106
|
licenses:
|
93
107
|
- MIT
|
94
108
|
metadata:
|
95
109
|
allowed_push_host: https://rubygems.org
|
96
110
|
bug_tracker_uri: https://github.com/mslinn/jekyll_href/issues
|
97
111
|
changelog_uri: https://github.com/mslinn/jekyll_href/CHANGELOG.md
|
98
|
-
homepage_uri: https://www.mslinn.com/
|
112
|
+
homepage_uri: https://www.mslinn.com/jekyll_plugins/jekyll_href.html
|
99
113
|
source_code_uri: https://github.com/mslinn/jekyll_href
|
100
114
|
post_install_message: |2+
|
101
115
|
|
@@ -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
|
...
|