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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 838cadb39ae8e31f560af6c84010e03e2f79770c46dc2002751e39ffc9173a40
4
- data.tar.gz: a6fc7f1c32e794e625f643c9ba6dd5943e0417699f1020d18eee9d9ce6062585
3
+ metadata.gz: ad27b62f30c018e8bd18e64aff15c9db271b8c8052f76b96387711bcced86af7
4
+ data.tar.gz: b0d7dc5ab8f04c8481762af18e1cc866680b7a24a4d3f87c0a0028e9e572e264
5
5
  SHA512:
6
- metadata.gz: 10b5ed831641ff8e3b8cfa0994c9555dcef27eb27c4d3a72814cb867d3401623f7142c923ac2f0358cfe5dfd41cc843247bda4ea421daaf8ec8f1abdeab43a10
7
- data.tar.gz: 91fd8a125ea762140ba0047d7aeabdb9325f9914809b08c9aa9490fe1a806ff7ec3b4eb2b2791a75816efc0b7d36ea3da8efaa67b8087d7abed0e8af7f2c662f
6
+ metadata.gz: 0325a5472644d4343a5fbd148413b9bb21b75ad81f03967d4605a979d346788a82c85096dee54025091ce94596ad608197ff4a37fd431c25d4f881881aa44c5e
7
+ data.tar.gz: f783aee2b38d287ce135db43ad92bc90c549cee2f2e5d60b94cb2e5c4636f642df464b5722f4e0094a758f0292e713ca8584c36223bebd061e2d29fedea9edc3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.0.8 / 2022-04-11
2
+ * Fixed match text
3
+
1
4
  ## 1.0.7 / 2022-04-11
2
5
  * Fixed bad reference when more than one URL matches
3
6
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllHrefVersion
4
- VERSION = "1.0.7"
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, 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 { "@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
@@ -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
- # puts "#{name}=#{value}"
145
- link = link.gsub("{{#{name}}}", value)
145
+ link = link.gsub "{{#{name}}}", value
146
146
  end
147
147
  link
148
148
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_href
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn