html-proofer 5.0.9 → 5.1.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/attribute/url.rb +4 -3
- data/lib/html_proofer/cache.rb +2 -2
- data/lib/html_proofer/check/images.rb +12 -12
- data/lib/html_proofer/configuration.rb +12 -1
- data/lib/html_proofer/log.rb +1 -1
- data/lib/html_proofer/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd5f97da4b4c9537822e31a821d41bcb04ea8eff97a5331d297ecb898ccd0630
|
|
4
|
+
data.tar.gz: 8d3df0b4bb5812e5aaa20907314bceef819134f56f55ad081776edc96e5406a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c65b869c013635c247c7235b3680d6c2ab99cc99c39eff43140a6ff8884f63bf70f3c625042d0a2124cf0e7b7bd36053c240cd1101ca768089657bb8b4fc17d
|
|
7
|
+
data.tar.gz: 239211f870b13baeb8c3f337005158c055c1dd53f5513092243c2d8548b5105e974a0472db85fc93e97bf91a83ad10c36d505ad778a5395030651a6e8a5d9199
|
|
@@ -133,8 +133,9 @@ module HTMLProofer
|
|
|
133
133
|
path_with_extension # existence checked implicitly by File.file?
|
|
134
134
|
# implicit index support
|
|
135
135
|
elsif File.directory?(path_to_resolve) && !unslashed_directory?(path_to_resolve)
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
@runner.options[:directory_index_files]
|
|
137
|
+
.map { |dif| File.join(path_to_resolve, dif) }
|
|
138
|
+
.find { |path_with_index| File.file?(path_with_index) }
|
|
138
139
|
# explicit file or directory
|
|
139
140
|
elsif File.exist?(path_to_resolve)
|
|
140
141
|
path_to_resolve
|
|
@@ -238,7 +239,7 @@ module HTMLProofer
|
|
|
238
239
|
else
|
|
239
240
|
url
|
|
240
241
|
end
|
|
241
|
-
rescue Addressable::URI::InvalidURIError # rubocop:disable Lint/SuppressedException
|
|
242
|
+
rescue Addressable::URI::InvalidURIError # rubocop:disable Lint/SuppressedException -- error will be reported at check time
|
|
242
243
|
end
|
|
243
244
|
|
|
244
245
|
private def swap_urls!
|
data/lib/html_proofer/cache.rb
CHANGED
|
@@ -34,9 +34,9 @@ module HTMLProofer
|
|
|
34
34
|
setup_cache!(options)
|
|
35
35
|
|
|
36
36
|
@external_timeframe = parsed_timeframe(options[:timeframe][:external])
|
|
37
|
-
define_singleton_method(:external_enabled?) { !@external_timeframe.nil? }
|
|
37
|
+
define_singleton_method(:external_enabled?) { !@external_timeframe.nil? } # rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
38
38
|
@internal_timeframe = parsed_timeframe(options[:timeframe][:internal])
|
|
39
|
-
define_singleton_method(:internal_enabled?) { !@internal_timeframe.nil? }
|
|
39
|
+
define_singleton_method(:internal_enabled?) { !@internal_timeframe.nil? } # rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -20,18 +20,6 @@ module HTMLProofer
|
|
|
20
20
|
# does the image exist?
|
|
21
21
|
if missing_src?
|
|
22
22
|
add_failure("image has no src or srcset attribute", element: @img)
|
|
23
|
-
elsif @img.url.protocol_relative?
|
|
24
|
-
add_failure(
|
|
25
|
-
"image link #{@img.url} is a protocol-relative URL, use explicit https:// instead",
|
|
26
|
-
element: @img,
|
|
27
|
-
)
|
|
28
|
-
elsif @img.url.remote?
|
|
29
|
-
add_to_external_urls(@img.url, @img.line)
|
|
30
|
-
elsif !@img.url.exists? && !@img.multiple_srcsets? && !@img.multiple_sizes?
|
|
31
|
-
add_failure(
|
|
32
|
-
"internal image #{@img.url.raw_attribute} does not exist",
|
|
33
|
-
element: @img,
|
|
34
|
-
)
|
|
35
23
|
elsif @img.multiple_srcsets? || @img.multiple_sizes?
|
|
36
24
|
@img.srcsets_wo_sizes.each do |srcset|
|
|
37
25
|
srcset_url = HTMLProofer::Attribute::Url.new(@runner, srcset, base_url: @img.base_url, source: @img.url.source, filename: @img.url.filename, extract_size: true)
|
|
@@ -47,6 +35,18 @@ module HTMLProofer
|
|
|
47
35
|
add_failure("internal image #{srcset} does not exist", element: @img)
|
|
48
36
|
end
|
|
49
37
|
end
|
|
38
|
+
elsif @img.url.protocol_relative?
|
|
39
|
+
add_failure(
|
|
40
|
+
"image link #{@img.url} is a protocol-relative URL, use explicit https:// instead",
|
|
41
|
+
element: @img,
|
|
42
|
+
)
|
|
43
|
+
elsif @img.url.remote?
|
|
44
|
+
add_to_external_urls(@img.url, @img.line)
|
|
45
|
+
elsif !@img.url.exists? && !@img.multiple_srcsets? && !@img.multiple_sizes?
|
|
46
|
+
add_failure(
|
|
47
|
+
"internal image #{@img.url.raw_attribute} does not exist",
|
|
48
|
+
element: @img,
|
|
49
|
+
)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# if this is an img element, check that the alt attribute is present
|
|
@@ -13,7 +13,7 @@ module HTMLProofer
|
|
|
13
13
|
check_external_hash: true,
|
|
14
14
|
check_internal_hash: true,
|
|
15
15
|
checks: DEFAULT_TESTS,
|
|
16
|
-
|
|
16
|
+
directory_index_files: ["index.html"],
|
|
17
17
|
disable_external: false,
|
|
18
18
|
ignore_empty_alt: true,
|
|
19
19
|
ignore_empty_mailto: false,
|
|
@@ -47,6 +47,12 @@ module HTMLProofer
|
|
|
47
47
|
|
|
48
48
|
class << self
|
|
49
49
|
def generate_defaults(opts)
|
|
50
|
+
# If `:directory_index_file` (singular) is given, convert it into an
|
|
51
|
+
# array for `:directory_index_files` (plural) instead.
|
|
52
|
+
if opts.key?(:directory_index_file)
|
|
53
|
+
opts[:directory_index_files] = [opts.delete(:directory_index_file)]
|
|
54
|
+
end
|
|
55
|
+
|
|
50
56
|
options = PROOFER_DEFAULTS.merge(opts)
|
|
51
57
|
|
|
52
58
|
options[:typhoeus] = HTMLProofer::Configuration::TYPHOEUS_DEFAULTS.merge(opts[:typhoeus] || {})
|
|
@@ -89,6 +95,10 @@ module HTMLProofer
|
|
|
89
95
|
@options[long_opt_symbol] = arg
|
|
90
96
|
end
|
|
91
97
|
|
|
98
|
+
set_option(opts, "--directory-index-files [FILENAME1,FILENAME2,...]") do |long_opt_symbol, list|
|
|
99
|
+
@options[long_opt_symbol] = list.nil? ? [] : list.split(",")
|
|
100
|
+
end
|
|
101
|
+
|
|
92
102
|
set_option(opts, "--extensions [EXT1,EXT2,...]") do |long_opt_symbol, list|
|
|
93
103
|
@options[long_opt_symbol] = list.nil? ? [] : list.split(",")
|
|
94
104
|
end
|
|
@@ -285,6 +295,7 @@ module HTMLProofer
|
|
|
285
295
|
"to allow extensionless URLs (as supported by most servers) (default: `.html`).",
|
|
286
296
|
],
|
|
287
297
|
directory_index_file: ["Sets the file to look for when a link refers to a directory. (default: `index.html`)."],
|
|
298
|
+
directory_index_files: ["Sets the files to look for when a link refers to a directory. (default: `[\"index.html\"]`)."],
|
|
288
299
|
extensions: [
|
|
289
300
|
"A comma-separated list of Strings indicating the file extensions you",
|
|
290
301
|
"would like to check (default: `.html`)",
|
data/lib/html_proofer/log.rb
CHANGED
data/lib/html_proofer/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: html-proofer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0
|
|
4
|
+
version: 5.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Garen Torikian
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -212,7 +212,7 @@ licenses:
|
|
|
212
212
|
metadata:
|
|
213
213
|
funding_uri: https://github.com/sponsors/gjtorikian/
|
|
214
214
|
rubygems_mfa_required: 'true'
|
|
215
|
-
post_install_message:
|
|
215
|
+
post_install_message:
|
|
216
216
|
rdoc_options: []
|
|
217
217
|
require_paths:
|
|
218
218
|
- lib
|
|
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
231
231
|
version: '0'
|
|
232
232
|
requirements: []
|
|
233
233
|
rubygems_version: 3.5.3
|
|
234
|
-
signing_key:
|
|
234
|
+
signing_key:
|
|
235
235
|
specification_version: 4
|
|
236
236
|
summary: A set of tests to validate your HTML output. These tests check if your image
|
|
237
237
|
references are legitimate, if they have alt tags, if your internal links are working,
|