jekyll_href 1.2.12 → 1.2.13
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/CHANGELOG.md +7 -0
- data/jekyll_href.gemspec +11 -10
- data/lib/href_match.rb +3 -2
- data/lib/href_summary.rb +1 -1
- data/lib/href_tag.rb +33 -1
- data/lib/jekyll_href/version.rb +1 -1
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15395e432574a69be4a28def40f3c20bf199fa762f8ca94155408e864921c406
|
4
|
+
data.tar.gz: 4d7385465ad6ddd8b9f52c6efbb62f7fd757015d10f23017e63639ddfc8e6670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 595817a332ef1fe8044249f075efc94a8fc6ba4f284ba2d97ef504d72cabf63799831c808e8450fe6c935d859c5296dda3805e42fd3ada764be2fe2c9985b616
|
7
|
+
data.tar.gz: 07b1e783d4b0015097229fda3a2257fdfc8b7b523673f212bdde3c7423eb889badd30a6f36b57c3dcd95eaea321f1f48cdd9db90f96cee167852b6f9b8aa4341
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.2.13 / 2024-12-23
|
4
|
+
|
5
|
+
* Fixed reference to undefined `url_matches`.
|
6
|
+
* References that point to draft pages are rendered differently in production mode,
|
7
|
+
and an info-level log message is generated.
|
8
|
+
|
9
|
+
|
3
10
|
## 1.2.12 / 2024-08-17
|
4
11
|
|
5
12
|
* Enhanced `match` so that if no label parameter is provided, the title of the matched web page is used.
|
data/jekyll_href.gemspec
CHANGED
@@ -3,15 +3,15 @@ require_relative 'lib/jekyll_href/version'
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
github = 'https://github.com/mslinn/jekyll_href'
|
5
5
|
|
6
|
-
spec.authors
|
7
|
-
spec.bindir
|
6
|
+
spec.authors = ['Mike Slinn']
|
7
|
+
spec.bindir = 'exe'
|
8
8
|
spec.description = <<~END_OF_DESC
|
9
9
|
Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'.
|
10
10
|
END_OF_DESC
|
11
|
-
spec.email
|
12
|
-
spec.files
|
11
|
+
spec.email = ['mslinn@mslinn.com']
|
12
|
+
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
13
13
|
spec.homepage = 'https://www.mslinn.com/jekyll_plugins/jekyll_href.html'
|
14
|
-
spec.license
|
14
|
+
spec.license = 'MIT'
|
15
15
|
spec.metadata = {
|
16
16
|
'allowed_push_host' => 'https://rubygems.org',
|
17
17
|
'bug_tracker_uri' => "#{github}/issues",
|
@@ -19,20 +19,21 @@ Gem::Specification.new do |spec|
|
|
19
19
|
'homepage_uri' => spec.homepage,
|
20
20
|
'source_code_uri' => github,
|
21
21
|
}
|
22
|
-
spec.name
|
22
|
+
spec.name = 'jekyll_href'
|
23
|
+
spec.platform = Gem::Platform::RUBY
|
23
24
|
spec.post_install_message = <<~END_MESSAGE
|
24
25
|
|
25
26
|
Thanks for installing #{spec.name}!
|
26
27
|
|
27
28
|
END_MESSAGE
|
28
|
-
spec.require_paths
|
29
|
+
spec.require_paths = ['lib']
|
29
30
|
spec.required_ruby_version = '>= 2.6.0'
|
30
|
-
spec.summary
|
31
|
-
spec.version
|
31
|
+
spec.summary = "Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'."
|
32
|
+
spec.version = JekyllHrefVersion::VERSION
|
32
33
|
|
33
34
|
spec.add_dependency 'ipaddress'
|
34
35
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
35
36
|
spec.add_dependency 'jekyll_all_collections'
|
36
|
-
spec.add_dependency 'jekyll_plugin_support', '>= 1.0.
|
37
|
+
spec.add_dependency 'jekyll_plugin_support', '>= 1.0.3'
|
37
38
|
spec.add_dependency 'typesafe_enum'
|
38
39
|
end
|
data/lib/href_match.rb
CHANGED
@@ -9,7 +9,8 @@ module JekyllSupport
|
|
9
9
|
msg = "HRef error: No url matches '#{@link}', found on line #{@line_number} (after front matter) of #{@path}"
|
10
10
|
@logger.error { msg }
|
11
11
|
abort msg if @die_if_nomatch
|
12
|
-
|
12
|
+
|
13
|
+
@text = "<i class='h_ref_error'>#{@link} is not a valid local page</i>"
|
13
14
|
@link_save = @link = '#'
|
14
15
|
when 1
|
15
16
|
@link = page_matches.first.url
|
@@ -17,7 +18,7 @@ module JekyllSupport
|
|
17
18
|
@link_save = @link
|
18
19
|
@text = page_matches.first.title unless @label
|
19
20
|
else
|
20
|
-
logger.error { "Error: More than one url matched '#{@path}'
|
21
|
+
logger.error { "Error: More than one url matched '#{@path}':\n #{page_matches.map(&:url).join("\n ")}" }
|
21
22
|
exit! 2
|
22
23
|
end
|
23
24
|
end
|
data/lib/href_summary.rb
CHANGED
data/lib/href_tag.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'ipaddress'
|
2
|
+
require 'jekyll_draft'
|
2
3
|
require 'jekyll_all_collections'
|
3
4
|
require 'jekyll_plugin_logger'
|
4
5
|
require 'jekyll_plugin_support'
|
@@ -46,12 +47,17 @@ module JekyllSupport
|
|
46
47
|
|
47
48
|
@helper_save = @helper.clone
|
48
49
|
globals_update(@helper.argv, linkk) # Sets @link and @text, might clear @follow and @target
|
49
|
-
handle_match(linkk) if @match # Sets @text if not set by now
|
50
|
+
handle_match(linkk) if @match # Sets @text if not set by now, also @link_type, etc.
|
50
51
|
raise HrefError, '@link_type was not set' if @link_type == LinkType::UNKNOWN
|
51
52
|
|
52
53
|
save_summary
|
53
54
|
klass = " class='#{@klass}'" if @klass
|
54
55
|
style = " style='#{@style}'" if @style
|
56
|
+
if @link_type == LinkType::LOCAL && local_page_draft?(@link)
|
57
|
+
klass = "draft_link #{klass}".strip
|
58
|
+
return "<span #{klass}#{style} title='This page is not available yet.'>#{@text}</span>" if @mode == 'production'
|
59
|
+
end
|
60
|
+
|
55
61
|
"<a href='#{@link}'#{klass}#{style}#{@target}#{@follow}>#{@text}</a>"
|
56
62
|
rescue HRefError => e # jekyll_plugin_support handles StandardError
|
57
63
|
@logger.error { e.logger_message }
|
@@ -64,6 +70,32 @@ module JekyllSupport
|
|
64
70
|
"On line #{line_number} of #{path}: #{follow} #{match} #{target} #{link} => '#{text}'"
|
65
71
|
end
|
66
72
|
|
73
|
+
def local_page_draft?(url)
|
74
|
+
filetype = File.extname url
|
75
|
+
page_matches = @site.all_collections.map.select { |page| page.url == url }
|
76
|
+
case page_matches.length
|
77
|
+
when 0
|
78
|
+
return false unless %w[htm html md].include? filetype
|
79
|
+
|
80
|
+
msg = "HRef error: No url matches '#{url}', found on line #{@line_number} (after front matter)"
|
81
|
+
@logger.error { msg }
|
82
|
+
abort msg if @die_if_nomatch
|
83
|
+
|
84
|
+
@text = "<i class='h_ref_error'>#{url} is not a valid local page</i>"
|
85
|
+
@link_save = @link = '#'
|
86
|
+
true
|
87
|
+
when 1
|
88
|
+
@link = page_matches.first.url
|
89
|
+
@link = "#{@link}##{@fragment}" if @fragment
|
90
|
+
@link_save = @link
|
91
|
+
@text = page_matches.first.title unless @label
|
92
|
+
Jekyll::Draft.draft? page_matches.first
|
93
|
+
else
|
94
|
+
logger.error { "Error: More than one url matched '#{url}'. Collections are: #{page_matches.join(', ')}" }
|
95
|
+
exit! 2
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
67
99
|
JekyllSupport::JekyllPluginHelper.register(self, 'href')
|
68
100
|
end
|
69
101
|
end
|
data/lib/jekyll_href/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-
|
10
|
+
date: 2024-12-23 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: ipaddress
|
@@ -58,14 +57,14 @@ dependencies:
|
|
58
57
|
requirements:
|
59
58
|
- - ">="
|
60
59
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.0.
|
60
|
+
version: 1.0.3
|
62
61
|
type: :runtime
|
63
62
|
prerelease: false
|
64
63
|
version_requirements: !ruby/object:Gem::Requirement
|
65
64
|
requirements:
|
66
65
|
- - ">="
|
67
66
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.0.
|
67
|
+
version: 1.0.3
|
69
68
|
- !ruby/object:Gem::Dependency
|
70
69
|
name: typesafe_enum
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
135
|
- !ruby/object:Gem::Version
|
137
136
|
version: '0'
|
138
137
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
140
|
-
signing_key:
|
138
|
+
rubygems_version: 3.6.0
|
141
139
|
specification_version: 4
|
142
140
|
summary: Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'.
|
143
141
|
test_files: []
|