jekyll_href 1.2.5 → 1.2.6

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: 071f512c7ac10e09846593c0ba16664176d94f4b231e2fb8c20d447671ebdafd
4
- data.tar.gz: 8b2bc1abb6ef1ce60a45e47623cf258215c0e17d74aac15ab13eaa5a003aff1d
3
+ metadata.gz: 7ce2ffe035bd807e82e6ec9f639677e82f4413bed796bc513962f384cea6b5e8
4
+ data.tar.gz: 90ae63c7030fe498a6e4eadb61a20927a110847fb70809058e7da41f8b4d2d72
5
5
  SHA512:
6
- metadata.gz: 8f5ec5bdbaec6ea11245945dfa442725b99788e1229b2f2f38a2e6ed5881f8c67270b78d391fde9ec5a6df801ef2fdbbbf8cfba89bcab215eac7317ac9d5bef1
7
- data.tar.gz: d0c075ec73231d74439cc4a804bd5fea1bb129ab4c018acb291c6aea531c633dd7f0c084c2ac361ba21b5fadbcaf7100a543fb019977f5d87927b36739c7bf95
6
+ metadata.gz: 6fd44f9bcb7aa12f2503333663be4fd7619c83e37563387997dd9043996127545a980a627b33677b8f1ee428af579dd3ff9ea84d0cf39f8095bc81199e8ea165
7
+ data.tar.gz: 1e5808fde63549696c8464c5d6e5127b32aa36a3f3919fbaf4a37d04cdf373f7b9861cfd459f2b61bc6d327e995c1303ae8642157ecce1f2f02e4537a5932d35
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.2.6 / 2023-06-18
2
+ * No longer blows up on error.
3
+
1
4
  ## 1.2.5 / 2023-05-26
2
5
  * Added `style` and `class` options.
3
6
 
data/jekyll_href.gemspec CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency 'ipaddress'
34
34
  spec.add_dependency 'jekyll', '>= 3.5.0'
35
- spec.add_dependency 'jekyll_all_collections', '~> 0.3.0', '>= 0.3.1'
36
- spec.add_dependency 'jekyll_plugin_support', '~> 0.6.0', '>= 0.6.1'
35
+ spec.add_dependency 'jekyll_all_collections', '>= 0.3.3'
36
+ spec.add_dependency 'jekyll_plugin_support', '>= 0.7.0'
37
+ spec.add_dependency 'sanitize'
37
38
  end
data/lib/href_tag.rb CHANGED
@@ -3,6 +3,7 @@ require 'jekyll_all_collections'
3
3
  require 'jekyll_plugin_logger'
4
4
  require 'jekyll_plugin_support'
5
5
  require 'liquid'
6
+ require 'sanitize'
6
7
  require_relative 'jekyll_href/version'
7
8
  require_relative 'hash_array'
8
9
 
@@ -38,7 +39,9 @@ module HrefTag
38
39
  # @return [String]
39
40
  def render_impl
40
41
  globals_initial
41
- linkk = compute_linkk
42
+ linkk, error_msg = compute_linkk
43
+ return error_msg unless linkk
44
+
42
45
  linkk = replace_vars(linkk)
43
46
  linkk.delete_prefix('./') # normalize relative links
44
47
  @url = linkk if @url
@@ -90,32 +93,27 @@ module HrefTag
90
93
 
91
94
  # Does not look at or compute @link
92
95
  def compute_linkk
93
- return @link if @link
96
+ return @link, nil if @link
94
97
 
95
98
  linkk = @url
96
99
  if linkk.nil? || !linkk
97
100
  linkk = @helper.argv&.shift
98
101
  @helper.params&.shift
99
102
  @helper.keys_values&.delete(linkk)
100
- dump_linkk_relations(linkk) if linkk.nil?
103
+ return nil, error_no_uri if linkk.nil?
101
104
  elsif @url.to_s.empty?
102
- dump_linkk_relations(linkk)
105
+ return nil, error_no_uri
103
106
  end
104
- linkk
107
+ [linkk, nil]
105
108
  end
106
109
 
107
- def dump_linkk_relations(linkk)
110
+ def error_no_uri
108
111
  msg = <<~END_MESSAGE
109
- jekyll_href error: no url was provided on #{@path}:#{@line_number}.
110
- @helper.markup=#{@helper.markup}
111
- @helper.argv='#{@helper.argv}'
112
- linkk='#{linkk}'
113
- @match='#{@match}'
114
- @url='#{@url}'
115
- @follow='#{@follow}
116
- @target='#{@target}'
112
+ Error: no url was provided on #{@path}:#{@line_number} (after front matter).
113
+ <pre>{% href #{@argument_string}%}</pre>
117
114
  END_MESSAGE
118
- abort msg.red
115
+ @logger.error { Sanitize.fragment msg }
116
+ "<span class='error'>Error: #{msg}</span>"
119
117
  end
120
118
 
121
119
  # Sets @follow, @helper, @match, @path, @shy, @target, @url, @wbr
@@ -1,3 +1,3 @@
1
1
  module JekyllHrefVersion
2
- VERSION = '1.2.5'.freeze
2
+ VERSION = '1.2.6'.freeze
3
3
  end
@@ -1,29 +1,15 @@
1
1
  example_id | status | run_time |
2
2
  ----------------------------------------------------------------- | ------ | --------------- |
3
- ./spec/hash_array_spec.rb[1:1] | passed | 0.17104 seconds |
4
- ./spec/href_spec.rb[1:1] | passed | 0.03236 seconds |
5
- ./spec/href_spec.rb[1:2] | passed | 0.02884 seconds |
6
- ./spec/href_spec.rb[1:3] | passed | 0.02956 seconds |
7
- ./spec/href_spec.rb[1:4] | passed | 0.02841 seconds |
8
- ./spec/href_spec.rb[1:5] | passed | 0.02897 seconds |
9
- ./spec/href_spec.rb[1:6] | passed | 0.02866 seconds |
10
- ./spec/href_spec.rb[1:7] | passed | 0.02966 seconds |
11
- ./spec/href_spec.rb[1:8] | passed | 0.02983 seconds |
12
- ./spec/href_spec.rb[1:9] | passed | 0.02735 seconds |
13
- ./spec/href_spec.rb[1:10] | passed | 0.02928 seconds |
14
- ./spec/href_spec.rb[1:11] | passed | 0.02861 seconds |
15
- ./spec/href_spec.rb[1:12] | passed | 0.02958 seconds |
16
- ./spec/href_spec.rb[1:13] | passed | 0.02714 seconds |
17
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:1] | passed | 0.02582 seconds |
18
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:2] | passed | 0.01031 seconds |
19
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:3] | passed | 0.01045 seconds |
20
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:4] | passed | 0.01038 seconds |
21
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:5] | passed | 0.01081 seconds |
22
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:6] | passed | 0.01053 seconds |
23
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:7] | passed | 0.01125 seconds |
24
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:8] | passed | 0.01113 seconds |
25
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:9] | passed | 0.01088 seconds |
26
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:10] | passed | 0.01066 seconds |
27
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:11] | failed | 0.06099 seconds |
28
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:12] | passed | 0.01096 seconds |
29
- /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:13] | passed | 0.01028 seconds |
3
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:1] | passed | 0.00817 seconds |
4
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:2] | passed | 0.00349 seconds |
5
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:3] | passed | 0.0033 seconds |
6
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:4] | passed | 0.00307 seconds |
7
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:5] | passed | 0.00315 seconds |
8
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:6] | passed | 0.0032 seconds |
9
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:7] | passed | 0.0035 seconds |
10
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:8] | passed | 0.00323 seconds |
11
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:9] | passed | 0.0032 seconds |
12
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:10] | passed | 0.00307 seconds |
13
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:11] | passed | 0.00317 seconds |
14
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:12] | passed | 0.00357 seconds |
15
+ /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:13] | passed | 0.0035 seconds |
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.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-26 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ipaddress
@@ -42,42 +42,44 @@ dependencies:
42
42
  name: jekyll_all_collections
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.3.0
48
45
  - - ">="
49
46
  - !ruby/object:Gem::Version
50
- version: 0.3.1
47
+ version: 0.3.3
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
- - - "~>"
56
- - !ruby/object:Gem::Version
57
- version: 0.3.0
58
52
  - - ">="
59
53
  - !ruby/object:Gem::Version
60
- version: 0.3.1
54
+ version: 0.3.3
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: jekyll_plugin_support
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: 0.6.0
68
59
  - - ">="
69
60
  - !ruby/object:Gem::Version
70
- version: 0.6.1
61
+ version: 0.7.0
71
62
  type: :runtime
72
63
  prerelease: false
73
64
  version_requirements: !ruby/object:Gem::Requirement
74
65
  requirements:
75
- - - "~>"
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
- version: 0.6.0
68
+ version: 0.7.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: sanitize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
78
73
  - - ">="
79
74
  - !ruby/object:Gem::Version
80
- version: 0.6.1
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
81
83
  description: 'Generates an ''a href'' tag, possibly with target=''_blank'' and rel=''nofollow''.
82
84
 
83
85
  '