html-proofer 5.1.1 → 5.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e9c313f10ad56f6c2f4d8175a61f39b3aba7f4f3ba4a13449bc0bdc0ed1e6fb
4
- data.tar.gz: 543b69993bee3fc3a1db0ca2d9775b09ecbc49f4350b151dc11b1b68711fdca3
3
+ metadata.gz: 03f01340b8aebd3ccad6d82ab5aef056991f91bae04498df5091b3c7e9e6641f
4
+ data.tar.gz: 3dda407dc70dc4d6d65ac88f6b3474e091832c3b37bc70d3bc74e8fdc4d136db
5
5
  SHA512:
6
- metadata.gz: f6625cacecccec0de69258290e0a6558468c0e8f0c858bdae061e114efa651a1f3a6715e7c732ad26abf5a5c6f6685748c4f9e81ed231a3412c6ba63e7dbbc00
7
- data.tar.gz: 56ea74876811867036dec18662c831356ce018ca770901ffba27aaa28f8a3f748f8be0fe7b0c6f5231e198b670a199a0db9d3a4b63a150b234e5f3805e291a98
6
+ metadata.gz: f652269525122a2199b373be5f19a3a93541f14e14539621f207605f5e346cf2cd34fe68cea4ed6e86236f37e69e5f1db709c68fab71816847b20248acb487a3
7
+ data.tar.gz: 487828db630f2916ab417d8d9d3cecbd8aa96a5140ee3695d2c49b589f3d8f286bcb9fef964bf517f08286e35500dfc6c0a1119f2f83d22d9f0a6653ad3a3c8d
@@ -71,8 +71,10 @@ module HTMLProofer
71
71
  return unless external_enabled?
72
72
 
73
73
  clean_url = cleaned_url(url)
74
+ # Filter out non-serializable element from metadata
75
+ cleaned_filenames = filenames.map { |f| f.except(:element) }
74
76
  @cache_log[:external][clean_url] =
75
- { time: @cache_time.to_s, found: found, status_code: status_code, message: msg, metadata: filenames }
77
+ { time: @cache_time.to_s, found: found, status_code: status_code, message: msg, metadata: cleaned_filenames }
76
78
  end
77
79
 
78
80
  def detect_url_changes(urls_detected, type)
@@ -186,7 +188,9 @@ module HTMLProofer
186
188
  hsh[url] = metadata_additions
187
189
  # remove from the cache the detected metadata additions as they correspond to failures to be rechecked
188
190
  # (this works assuming the detected url metadata have "found" set to false)
189
- @cache_log[:internal][url][:metadata] = cache_metadata.difference(metadata_additions)
191
+ # Compare without the :element key since cached metadata doesn't have it
192
+ metadata_additions_for_diff = metadata_additions.map { |m| m.except(:element) }
193
+ @cache_log[:internal][url][:metadata] = cache_metadata.difference(metadata_additions_for_diff)
190
194
  end
191
195
  end
192
196
 
@@ -22,7 +22,7 @@ module HTMLProofer
22
22
  element: @favicon,
23
23
  )
24
24
  elsif @favicon.url.remote?
25
- add_to_external_urls(@favicon.url, @favicon.line)
25
+ add_to_external_urls(@favicon.url, @favicon)
26
26
  elsif !@favicon.url.exists?
27
27
  add_failure(
28
28
  "internal favicon #{@favicon.url.raw_attribute} does not exist",
@@ -30,7 +30,7 @@ module HTMLProofer
30
30
  element: @img,
31
31
  )
32
32
  elsif srcset_url.remote?
33
- add_to_external_urls(srcset_url.url, @img.line)
33
+ add_to_external_urls(srcset_url.url, @img)
34
34
  elsif !srcset_url.exists?
35
35
  add_failure("internal image #{srcset} does not exist", element: @img)
36
36
  end
@@ -41,7 +41,7 @@ module HTMLProofer
41
41
  element: @img,
42
42
  )
43
43
  elsif @img.url.remote?
44
- add_to_external_urls(@img.url, @img.line)
44
+ add_to_external_urls(@img.url, @img)
45
45
  elsif !@img.url.exists? && !@img.multiple_srcsets? && !@img.multiple_sizes?
46
46
  add_failure(
47
47
  "internal image #{@img.url.raw_attribute} does not exist",
@@ -53,7 +53,7 @@ module HTMLProofer
53
53
  next
54
54
  end
55
55
 
56
- add_to_external_urls(@link.url, @link.line)
56
+ add_to_external_urls(@link.url, @link)
57
57
  elsif @link.url.internal?
58
58
  # does the local directory have a trailing slash?
59
59
  if @link.url.unslashed_directory?(@link.url.absolute_path)
@@ -64,7 +64,7 @@ module HTMLProofer
64
64
  next
65
65
  end
66
66
 
67
- add_to_internal_urls(@link.url, @link.line)
67
+ add_to_internal_urls(@link.url, @link)
68
68
  end
69
69
  end
70
70
  end
@@ -22,7 +22,7 @@ module HTMLProofer
22
22
  element: @open_graph,
23
23
  )
24
24
  elsif @open_graph.url.remote?
25
- add_to_external_urls(@open_graph.url, @open_graph.line)
25
+ add_to_external_urls(@open_graph.url, @open_graph)
26
26
  else
27
27
  add_failure(
28
28
  "internal open graph #{@open_graph.url.raw_attribute} does not exist",
@@ -19,7 +19,7 @@ module HTMLProofer
19
19
  element: @script,
20
20
  )
21
21
  elsif @script.url.remote?
22
- add_to_external_urls(@script.url, @script.line)
22
+ add_to_external_urls(@script.url, @script)
23
23
  check_sri if @runner.check_sri?
24
24
  elsif !@script.url.exists?
25
25
  add_failure(
@@ -32,6 +32,7 @@ module HTMLProofer
32
32
  line: element.nil? ? line : element.line,
33
33
  status: status,
34
34
  content: element.nil? ? content : element.content,
35
+ element: element,
35
36
  )
36
37
  end
37
38
 
@@ -39,7 +40,7 @@ module HTMLProofer
39
40
  self.class.name.split("::").last
40
41
  end
41
42
 
42
- def add_to_internal_urls(url, line)
43
+ def add_to_internal_urls(url, element)
43
44
  url_string = url.raw_attribute
44
45
 
45
46
  @internal_urls[url_string] = [] if @internal_urls[url_string].nil?
@@ -47,19 +48,20 @@ module HTMLProofer
47
48
  metadata = {
48
49
  source: url.source,
49
50
  filename: url.filename,
50
- line: line,
51
+ line: element.line,
51
52
  base_url: base_url,
52
53
  found: false,
54
+ element: element,
53
55
  }
54
56
  @internal_urls[url_string] << metadata
55
57
  end
56
58
 
57
- def add_to_external_urls(url, line)
59
+ def add_to_external_urls(url, element)
58
60
  url_string = url.to_s
59
61
 
60
62
  @external_urls[url_string] = [] if @external_urls[url_string].nil?
61
63
 
62
- @external_urls[url_string] << { filename: url.filename, line: line }
64
+ @external_urls[url_string] << { filename: url.filename, line: element.line, element: element }
63
65
  end
64
66
 
65
67
  class << self
@@ -2,9 +2,9 @@
2
2
 
3
3
  module HTMLProofer
4
4
  class Failure
5
- attr_reader :path, :check_name, :description, :status, :line, :content
5
+ attr_reader :path, :check_name, :description, :status, :line, :content, :element
6
6
 
7
- def initialize(path, check_name, description, line: nil, status: nil, content: nil)
7
+ def initialize(path, check_name, description, line: nil, status: nil, content: nil, element: nil)
8
8
  @path = path
9
9
  @check_name = check_name
10
10
  @description = description
@@ -12,6 +12,7 @@ module HTMLProofer
12
12
  @line = line
13
13
  @status = status
14
14
  @content = content
15
+ @element = element
15
16
  end
16
17
  end
17
18
  end
@@ -195,7 +195,15 @@ module HTMLProofer
195
195
  @failed_checks << Failure.new("", "Links > External", description, status: status)
196
196
  else
197
197
  metadata.each do |m|
198
- @failed_checks << Failure.new(m[:filename], "Links > External", description, line: m[:line], status: status)
198
+ @failed_checks << Failure.new(
199
+ m[:filename],
200
+ "Links > External",
201
+ description,
202
+ line: m[:line],
203
+ status: status,
204
+ content: m[:element]&.content,
205
+ element: m[:element],
206
+ )
199
207
  end
200
208
  end
201
209
  end
@@ -38,7 +38,8 @@ module HTMLProofer
38
38
  "internally linking to #{url}, which does not exist",
39
39
  line: metadata[:line],
40
40
  status: nil,
41
- content: nil,
41
+ content: metadata[:element]&.content,
42
+ element: metadata[:element],
42
43
  )
43
44
  to_add << [url, metadata, false]
44
45
  next
@@ -64,7 +65,8 @@ module HTMLProofer
64
65
  "internally linking to #{url}; the file exists, but the hash '#{url.hash}' does not",
65
66
  line: metadata[:line],
66
67
  status: nil,
67
- content: nil,
68
+ content: metadata[:element]&.content,
69
+ element: metadata[:element],
68
70
  )
69
71
  to_add << [url, metadata, false]
70
72
  next
@@ -90,7 +92,8 @@ module HTMLProofer
90
92
  "internally linking to #{url}; the file exists, but the hash '#{href_hash}' does not",
91
93
  line: metadata[:line],
92
94
  status: nil,
93
- content: nil,
95
+ content: metadata[:element]&.content,
96
+ element: metadata[:element],
94
97
  )
95
98
  end
96
99
  to_add << [url, metadata, exists]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = "5.1.1"
4
+ VERSION = "5.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-proofer
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-11-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: addressable
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '2.3'
27
- force_ruby_platform: false
28
26
  - !ruby/object:Gem::Dependency
29
27
  name: async
30
28
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +37,6 @@ dependencies:
39
37
  - - "~>"
40
38
  - !ruby/object:Gem::Version
41
39
  version: '2.1'
42
- force_ruby_platform: false
43
40
  - !ruby/object:Gem::Dependency
44
41
  name: benchmark
45
42
  requirement: !ruby/object:Gem::Requirement
@@ -54,7 +51,6 @@ dependencies:
54
51
  - - "~>"
55
52
  - !ruby/object:Gem::Version
56
53
  version: '0.5'
57
- force_ruby_platform: false
58
54
  - !ruby/object:Gem::Dependency
59
55
  name: nokogiri
60
56
  requirement: !ruby/object:Gem::Requirement
@@ -69,7 +65,6 @@ dependencies:
69
65
  - - "~>"
70
66
  - !ruby/object:Gem::Version
71
67
  version: '1.13'
72
- force_ruby_platform: false
73
68
  - !ruby/object:Gem::Dependency
74
69
  name: pdf-reader
75
70
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +79,6 @@ dependencies:
84
79
  - - "~>"
85
80
  - !ruby/object:Gem::Version
86
81
  version: '2.11'
87
- force_ruby_platform: false
88
82
  - !ruby/object:Gem::Dependency
89
83
  name: rainbow
90
84
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +93,6 @@ dependencies:
99
93
  - - "~>"
100
94
  - !ruby/object:Gem::Version
101
95
  version: '3.0'
102
- force_ruby_platform: false
103
96
  - !ruby/object:Gem::Dependency
104
97
  name: typhoeus
105
98
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +107,6 @@ dependencies:
114
107
  - - "~>"
115
108
  - !ruby/object:Gem::Version
116
109
  version: '1.3'
117
- force_ruby_platform: false
118
110
  - !ruby/object:Gem::Dependency
119
111
  name: yell
120
112
  requirement: !ruby/object:Gem::Requirement
@@ -129,7 +121,6 @@ dependencies:
129
121
  - - "~>"
130
122
  - !ruby/object:Gem::Version
131
123
  version: '2.0'
132
- force_ruby_platform: false
133
124
  - !ruby/object:Gem::Dependency
134
125
  name: zeitwerk
135
126
  requirement: !ruby/object:Gem::Requirement
@@ -144,7 +135,6 @@ dependencies:
144
135
  - - "~>"
145
136
  - !ruby/object:Gem::Version
146
137
  version: '2.5'
147
- force_ruby_platform: false
148
138
  - !ruby/object:Gem::Dependency
149
139
  name: rspec
150
140
  requirement: !ruby/object:Gem::Requirement
@@ -179,14 +169,14 @@ dependencies:
179
169
  requirements:
180
170
  - - "~>"
181
171
  - !ruby/object:Gem::Version
182
- version: '2.9'
172
+ version: '6.4'
183
173
  type: :development
184
174
  prerelease: false
185
175
  version_requirements: !ruby/object:Gem::Requirement
186
176
  requirements:
187
177
  - - "~>"
188
178
  - !ruby/object:Gem::Version
189
- version: '2.9'
179
+ version: '6.4'
190
180
  description: Test your rendered HTML files to make sure they're accurate.
191
181
  email:
192
182
  - gjtorikian@gmail.com
@@ -227,7 +217,6 @@ licenses:
227
217
  metadata:
228
218
  funding_uri: https://github.com/sponsors/gjtorikian/
229
219
  rubygems_mfa_required: 'true'
230
- post_install_message:
231
220
  rdoc_options: []
232
221
  require_paths:
233
222
  - lib
@@ -245,8 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
234
  - !ruby/object:Gem::Version
246
235
  version: '0'
247
236
  requirements: []
248
- rubygems_version: 3.5.3
249
- signing_key:
237
+ rubygems_version: 4.0.3
250
238
  specification_version: 4
251
239
  summary: A set of tests to validate your HTML output. These tests check if your image
252
240
  references are legitimate, if they have alt tags, if your internal links are working,