jekyll_href 1.0.5 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77d32b91a5b8672c01da9a683e709d7b35f24bdd891b86768e05c36c6c57e5aa
4
- data.tar.gz: 1a393c397d3ea037f31e6784a80131b4a0a801f5a214f5bc7cba60004f8e68b0
3
+ metadata.gz: ad27b62f30c018e8bd18e64aff15c9db271b8c8052f76b96387711bcced86af7
4
+ data.tar.gz: b0d7dc5ab8f04c8481762af18e1cc866680b7a24a4d3f87c0a0028e9e572e264
5
5
  SHA512:
6
- metadata.gz: e5ce91fdf37cc85e746229b312cb3d3d70fdf6ccfe011241ec883a0d28feb2134a86b4f1cbf29e17f05771dc8c2366429a0660cdf1e8064e1f52ea1ec0d3a8d0
7
- data.tar.gz: 6d6632c16d94f32d37697633cb225896bd6a98e2fc0a0302796d1751a09a8e8995f01020f456c4375e04580d9eb7e868e7f1ab57454c40a6ebfd4d9143678159
6
+ metadata.gz: 0325a5472644d4343a5fbd148413b9bb21b75ad81f03967d4605a979d346788a82c85096dee54025091ce94596ad608197ff4a37fd431c25d4f881881aa44c5e
7
+ data.tar.gz: f783aee2b38d287ce135db43ad92bc90c549cee2f2e5d60b94cb2e5c4636f642df464b5722f4e0094a758f0292e713ca8584c36223bebd061e2d29fedea9edc3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 1.0.8 / 2022-04-11
2
+ * Fixed match text
3
+
4
+ ## 1.0.7 / 2022-04-11
5
+ * Fixed bad reference when more than one URL matches
6
+
7
+ ## 1.0.6 / 2022-04-05
8
+ * Updated to `jekyll_plugin_logger` v2.1.0
9
+
1
10
  ## 1.0.5 / 2022-03-28
2
11
  * Fixed problem with URI rendering
3
12
 
data/jekyll_href.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.required_ruby_version = ">= 2.6.0"
32
32
  spec.summary = "Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'."
33
33
  spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
34
- spec.version = JekyllHref::VERSION
34
+ spec.version = JekyllHrefVersion::VERSION
35
35
 
36
36
  spec.add_dependency 'jekyll', '>= 3.5.0'
37
37
  spec.add_dependency 'jekyll_plugin_logger'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module JekyllHref
4
- VERSION = "1.0.5"
3
+ module JekyllHrefVersion
4
+ VERSION = "1.0.8"
5
5
  end
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)
66
66
 
67
67
  match_index = @tokens.index("match")
68
68
  if match_index
@@ -118,35 +118,35 @@ class ExternalHref < Liquid::Tag
118
118
 
119
119
  path, fragment = @link.split('#')
120
120
 
121
- @logger.debug { "@link=#{@link}" }
122
- @logger.debug { "site.posts[0].url = #{site.posts.docs[0].url}" }
123
- @logger.debug { "site.posts[0].path = #{site.posts.docs[0].path}" }
124
- posts = site.posts.docs.select { |x| x.url.include?(path) }
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
- abort "href error: No url matches '#{@link}'"
129
- else
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
136
137
  else
137
- abort "Error: More than one url matched: #{ matches.join(", ")}"
138
+ abort "Error: More than one url matched: #{ posts.map(&:relative_path).join(", ")}"
138
139
  end
139
140
  end
140
141
 
141
142
  def replace_vars(context, link)
142
143
  variables = context.registers[:site].config['plugin-vars']
143
144
  variables.each do |name, value|
144
- # puts "#{name}=#{value}"
145
- link = link.gsub("{{#{name}}}", value)
145
+ link = link.gsub "{{#{name}}}", value
146
146
  end
147
147
  link
148
148
  end
149
149
  end
150
150
 
151
- PluginMetaLogger.instance.info { "Loaded jeykll_href v#{JekyllHref::VERSION} plugin." }
151
+ PluginMetaLogger.instance.info { "Loaded jeykll_href v#{JekyllHrefVersion::VERSION} plugin." }
152
152
  Liquid::Template.register_tag('href', ExternalHref)
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.5
4
+ version: 1.0.8
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-03-28 00:00:00.000000000 Z
11
+ date: 2022-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll