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 +4 -4
- data/lib/html_proofer/cache.rb +6 -2
- data/lib/html_proofer/check/favicon.rb +1 -1
- data/lib/html_proofer/check/images.rb +2 -2
- data/lib/html_proofer/check/links.rb +2 -2
- data/lib/html_proofer/check/open_graph.rb +1 -1
- data/lib/html_proofer/check/scripts.rb +1 -1
- data/lib/html_proofer/check.rb +6 -4
- data/lib/html_proofer/failure.rb +3 -2
- data/lib/html_proofer/url_validator/external.rb +9 -1
- data/lib/html_proofer/url_validator/internal.rb +6 -3
- data/lib/html_proofer/version.rb +1 -1
- metadata +5 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03f01340b8aebd3ccad6d82ab5aef056991f91bae04498df5091b3c7e9e6641f
|
|
4
|
+
data.tar.gz: 3dda407dc70dc4d6d65ac88f6b3474e091832c3b37bc70d3bc74e8fdc4d136db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f652269525122a2199b373be5f19a3a93541f14e14539621f207605f5e346cf2cd34fe68cea4ed6e86236f37e69e5f1db709c68fab71816847b20248acb487a3
|
|
7
|
+
data.tar.gz: 487828db630f2916ab417d8d9d3cecbd8aa96a5140ee3695d2c49b589f3d8f286bcb9fef964bf517f08286e35500dfc6c0a1119f2f83d22d9f0a6653ad3a3c8d
|
data/lib/html_proofer/cache.rb
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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",
|
data/lib/html_proofer/check.rb
CHANGED
|
@@ -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,
|
|
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,
|
|
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
|
data/lib/html_proofer/failure.rb
CHANGED
|
@@ -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(
|
|
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:
|
|
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:
|
|
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:
|
|
95
|
+
content: metadata[:element]&.content,
|
|
96
|
+
element: metadata[:element],
|
|
94
97
|
)
|
|
95
98
|
end
|
|
96
99
|
to_add << [url, metadata, exists]
|
data/lib/html_proofer/version.rb
CHANGED
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.
|
|
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:
|
|
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: '
|
|
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: '
|
|
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:
|
|
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,
|