html-proofer 5.0.2 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html_proofer/element.rb +16 -1
- data/lib/html_proofer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 337d1725f7139e6efda6d350b83b15ecfd51eb67ee44e068f1b29859104320dd
|
4
|
+
data.tar.gz: 3ad1dcdb66a4789853e92303a1cd6e9872d95db137ab589df75f5f6af00d7ed0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 656b20f4feeffc2dca48e38e42d510c8b7f5d4e7f563167429e0c687c0b1a938008dfe8bb7e21591ed8a5c76fd7ea8c20d63b78f2c71fcf54a3a9bcf55970a7e
|
7
|
+
data.tar.gz: 490f87dcd3a849a55c2051e56e93e8b65e47e18ffea0fd82061b8418736709cff5ec5230fd84d937e7b748ccec19c644650ef970dda49a0ce100f57914be6418
|
data/lib/html_proofer/element.rb
CHANGED
@@ -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(
|
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?
|
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.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -306,7 +306,7 @@ 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.
|
309
|
+
rubygems_version: 3.3.26
|
310
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
|