jekyll_href 1.0.8 → 1.0.9
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 +3 -0
- data/README.md +3 -0
- data/lib/jekyll_href/version.rb +1 -1
- data/lib/jekyll_href.rb +9 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d98dd353e927f8df1cf3832b2afefebb7be6dda942346cfaefb4899ec4de2606
|
4
|
+
data.tar.gz: 3bae16798938728a608f21161324d5843da1e0df1e210ac0e34cf894d5d29ed4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27cc832e73c2eaf4db34dcb6cb67c026702ed9e106aa965d61a572cb44c0c4edcc0ca08ad0039c24e074734ecbce6f71643f6e049e76d6830ba64a548a35ed04
|
7
|
+
data.tar.gz: 819b74d3d7c6e1a6a6bc7d01797cccaa0c888dfcc7d3e8464b65c1d150bf5fa4dca349275e487163cf24ec38e7acaceae9d525a73f8eb5bf2676383cb85aa1a3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,6 +16,9 @@ Also provides a convenient way to generate formatted and clickable URIs.
|
|
16
16
|
Note that the url should not be enclosed in quotes.
|
17
17
|
Also please note that the square brackets denote optional parameters, and should not be typed.
|
18
18
|
|
19
|
+
`match` will attempt to match the url fragment (specified as a regex) to a URL in any collection.
|
20
|
+
If multiple documents have matching URL an error is thrown.
|
21
|
+
|
19
22
|
|
20
23
|
### Additional Information
|
21
24
|
More information is available on my web site about [my Jekyll plugins](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html).
|
data/lib/jekyll_href/version.rb
CHANGED
data/lib/jekyll_href.rb
CHANGED
@@ -125,17 +125,22 @@ class ExternalHref < Liquid::Tag
|
|
125
125
|
site.posts[0].path = #{site.posts.docs[0].path}
|
126
126
|
END_DEBUG
|
127
127
|
}
|
128
|
-
|
129
|
-
|
128
|
+
urls = site.collections
|
129
|
+
.values
|
130
|
+
.map { |x| x.class.method_defined?(:docs) ? x.docs : x }
|
131
|
+
.flatten
|
132
|
+
.map(&:url) # TODO Optimize this by caching the result
|
133
|
+
url_matches = urls.select { |url| url.include? path }
|
134
|
+
case url_matches.length
|
130
135
|
when 0
|
131
136
|
abort "href error: No url matches '#{@link}'" if die_if_nomatch
|
132
137
|
@link = "#"
|
133
138
|
@text = "<i>#{@link} is not available</i>"
|
134
139
|
when 1
|
135
|
-
@link =
|
140
|
+
@link = url_matches.first
|
136
141
|
@link = "#{@link}\##{fragment}" if fragment
|
137
142
|
else
|
138
|
-
abort "Error: More than one url matched: #{
|
143
|
+
abort "Error: More than one url matched '#{path}': #{ url_matches.join(", ")}"
|
139
144
|
end
|
140
145
|
end
|
141
146
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_href
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|