jekyll_href 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/jekyll_href/version.rb +1 -1
- data/lib/jekyll_href.rb +13 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad27b62f30c018e8bd18e64aff15c9db271b8c8052f76b96387711bcced86af7
|
4
|
+
data.tar.gz: b0d7dc5ab8f04c8481762af18e1cc866680b7a24a4d3f87c0a0028e9e572e264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0325a5472644d4343a5fbd148413b9bb21b75ad81f03967d4605a979d346788a82c85096dee54025091ce94596ad608197ff4a37fd431c25d4f881881aa44c5e
|
7
|
+
data.tar.gz: f783aee2b38d287ce135db43ad92bc90c549cee2f2e5d60b94cb2e5c4636f642df464b5722f4e0094a758f0292e713ca8584c36223bebd061e2d29fedea9edc3
|
data/CHANGELOG.md
CHANGED
data/lib/jekyll_href/version.rb
CHANGED
data/lib/jekyll_href.rb
CHANGED
@@ -58,11 +58,11 @@ class ExternalHref < Liquid::Tag
|
|
58
58
|
def initialize(tag_name, command_line, _parse_context)
|
59
59
|
super
|
60
60
|
|
61
|
+
@logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
61
62
|
@match = false
|
62
63
|
@tokens = command_line.strip.split
|
63
64
|
@follow = get_value("follow", " rel='nofollow'")
|
64
65
|
@target = get_value("notarget", " target='_blank'")
|
65
|
-
@logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
66
66
|
|
67
67
|
match_index = @tokens.index("match")
|
68
68
|
if match_index
|
@@ -118,18 +118,19 @@ class ExternalHref < Liquid::Tag
|
|
118
118
|
|
119
119
|
path, fragment = @link.split('#')
|
120
120
|
|
121
|
-
@logger.debug {
|
122
|
-
|
123
|
-
|
124
|
-
|
121
|
+
@logger.debug {
|
122
|
+
<<~END_DEBUG
|
123
|
+
@link=#{@link}
|
124
|
+
site.posts[0].url = #{site.posts.docs[0].url}
|
125
|
+
site.posts[0].path = #{site.posts.docs[0].path}
|
126
|
+
END_DEBUG
|
127
|
+
}
|
128
|
+
posts = site.posts.docs.select { |x| x.url.include? path }
|
125
129
|
case posts.length
|
126
130
|
when 0
|
127
|
-
if die_if_nomatch
|
128
|
-
|
129
|
-
|
130
|
-
@link = "#"
|
131
|
-
@text = "<i>#{@link} is not available</i>"
|
132
|
-
end
|
131
|
+
abort "href error: No url matches '#{@link}'" if die_if_nomatch
|
132
|
+
@link = "#"
|
133
|
+
@text = "<i>#{@link} is not available</i>"
|
133
134
|
when 1
|
134
135
|
@link = posts.first.url
|
135
136
|
@link = "#{@link}\##{fragment}" if fragment
|
@@ -141,8 +142,7 @@ class ExternalHref < Liquid::Tag
|
|
141
142
|
def replace_vars(context, link)
|
142
143
|
variables = context.registers[:site].config['plugin-vars']
|
143
144
|
variables.each do |name, value|
|
144
|
-
|
145
|
-
link = link.gsub("{{#{name}}}", value)
|
145
|
+
link = link.gsub "{{#{name}}}", value
|
146
146
|
end
|
147
147
|
link
|
148
148
|
end
|