html-proofer 5.0.1 → 5.0.3

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: 44d7d6b601b41b5bf4c4ae8084b982fcb2b5dfcb6e5a56ec27c9f6ddb984f949
4
- data.tar.gz: 88c9d25790610eabf95be2f52ab4f8d48c4cea795389b9eb858633c629001328
3
+ metadata.gz: 337d1725f7139e6efda6d350b83b15ecfd51eb67ee44e068f1b29859104320dd
4
+ data.tar.gz: 3ad1dcdb66a4789853e92303a1cd6e9872d95db137ab589df75f5f6af00d7ed0
5
5
  SHA512:
6
- metadata.gz: 34a4e54a59920ca4f334fbb46374796abbaa97294d89a6bf1d339edbb1fad2e128ea1e9dea4ef876745ae6dc7279f23eec743c7c17220f8bd2e89079d019e109
7
- data.tar.gz: 25cc51cd7495b1539354ba8be234ca660fb3cb4d4cee45dd514e61e350d8899a1c9756401697307e8e4de5313fdad0e229f12dd090c7f8e7b0ae143bf103140f
6
+ metadata.gz: 656b20f4feeffc2dca48e38e42d510c8b7f5d4e7f563167429e0c687c0b1a938008dfe8bb7e21591ed8a5c76fd7ea8c20d63b78f2c71fcf54a3a9bcf55970a7e
7
+ data.tar.gz: 490f87dcd3a849a55c2051e56e93e8b65e47e18ffea0fd82061b8418736709cff5ec5230fd84d937e7b748ccec19c644650ef970dda49a0ce100f57914be6418
@@ -197,12 +197,12 @@ module HTMLProofer
197
197
  @options[long_opt_symbol] = parse_json_option("typhoeus", arg, symbolize_names: false)
198
198
  end
199
199
 
200
- set_option(opts, "--hydra <CONFIG>") do |long_opt_symbol, _list|
201
- @options[long_opt_symbol] = parse_json_option("hydra", arg, symbolize_names: false)
200
+ set_option(opts, "--hydra <CONFIG>") do |long_opt_symbol, arg|
201
+ @options[long_opt_symbol] = parse_json_option("hydra", arg, symbolize_names: true)
202
202
  end
203
203
 
204
- set_option(opts, "--cache <CONFIG>") do |long_opt_symbol, _list|
205
- @options[long_opt_symbol] = parse_json_option("cache", arg, symbolize_names: false)
204
+ set_option(opts, "--cache <CONFIG>") do |long_opt_symbol, arg|
205
+ @options[long_opt_symbol] = parse_json_option("cache", arg, symbolize_names: true)
206
206
  end
207
207
  end
208
208
 
@@ -82,10 +82,25 @@ module HTMLProofer
82
82
  !blank?(srcset) && srcset.split(",").size > 1
83
83
  end
84
84
 
85
+ # From https://github.com/sindresorhus/srcset/blob/f7c48acd7facf18e94dec47e6b96e84e0f0e69dc/index.js#LL1-L16C71
86
+ # This regex represents a loose rule of an “image candidate string”; see https://html.spec.whatwg.org/multipage/images.html#srcset-attribute
87
+ # An “image candidate string” roughly consists of the following:
88
+ # 1. Zero or more whitespace characters.
89
+ # 2. A non-empty URL that does not start or end with `,`.
90
+ # 3. Zero or more whitespace characters.
91
+ # 4. An optional “descriptor” that starts with a whitespace character.
92
+ # 5. Zero or more whitespace characters.
93
+ # 6. Each image candidate string is separated by a `,`.
94
+ # We intentionally implement a loose rule here so that we can perform more aggressive error handling and reporting in the below code.
95
+
96
+ IMAGE_CANDIDATE_REGEX = /\s*([^,]\S*[^,](?:\s+[^,]+)?)\s*(?:,|$)/
97
+
85
98
  def srcsets
86
99
  return nil if blank?(srcset)
87
100
 
88
- srcset.split(",").map(&:strip)
101
+ srcset.split(IMAGE_CANDIDATE_REGEX).select.with_index do |_part, idx|
102
+ idx.odd?
103
+ end.map(&:strip)
89
104
  end
90
105
 
91
106
  def multiple_sizes?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = "5.0.1"
4
+ VERSION = "5.0.3"
5
5
  end
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.1
4
+ version: 5.0.3
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: 2022-11-01 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -288,7 +288,7 @@ licenses:
288
288
  metadata:
289
289
  funding_uri: https://github.com/sponsors/gjtorikian/
290
290
  rubygems_mfa_required: 'true'
291
- post_install_message:
291
+ post_install_message:
292
292
  rdoc_options: []
293
293
  require_paths:
294
294
  - lib
@@ -306,8 +306,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
306
  - !ruby/object:Gem::Version
307
307
  version: '0'
308
308
  requirements: []
309
- rubygems_version: 3.3.22
310
- signing_key:
309
+ rubygems_version: 3.3.26
310
+ signing_key:
311
311
  specification_version: 4
312
312
  summary: A set of tests to validate your HTML output. These tests check if your image
313
313
  references are legitimate, if they have alt tags, if your internal links are working,