html-proofer 3.0.5 → 3.0.6
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/bin/htmlproofer +2 -0
- data/lib/html-proofer/check/html.rb +5 -0
- data/lib/html-proofer/check/images.rb +1 -1
- data/lib/html-proofer/configuration.rb +1 -0
- data/lib/html-proofer/element.rb +3 -2
- data/lib/html-proofer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b26505bd1c7a6f0632a95f2bb1718ae9e2bae90f
|
4
|
+
data.tar.gz: c8cbb29407b3eedcd997f8e9226323c6e4a55dc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1432ff5ff5ad2c0eeb1ef40b66f46608f0d737e39474f2e8185614ca6ede77af17fd4dd1893fa86fa12bf2c6f9c2c12b19a5713044b99cc705f2a43e236e57be
|
7
|
+
data.tar.gz: 0f1a23a1534ef863223808efb54dcb493ebb04a51a1793fd25f3875d89e891a19e8beea085791947bee5791a93baa68f4dc2048406acc71b822477b28cef7d6a
|
data/bin/htmlproofer
CHANGED
@@ -31,6 +31,7 @@ Mercenary.program(:htmlproofer) do |p|
|
|
31
31
|
p.option 'file_ignore', '--file-ignore file1,[file2,...]', Array, 'A comma-separated list of Strings or RegExps containing file paths that are safe to ignore'
|
32
32
|
p.option 'http_status_ignore', '--http-status-ignore 123,[xxx, ...]', Array, 'A comma-separated list of numbers representing status codes to ignore.'
|
33
33
|
p.option 'report_invalid_tags', '--report-invalid-tags', 'Ignore `check_html` errors associated with unknown markup (default: `false`)'
|
34
|
+
p.option 'report_missing_names', '--report-missing-names', 'Ignore `check_html` errors associated with missing entities (default: `false`)'
|
34
35
|
p.option 'report_script_embeds', '--report-script-embeds', 'Ignore `check_html` errors associated with `script`s (default: `false`)'
|
35
36
|
p.option 'log_level', '--log-level <level>', String, 'Sets the logging level, as determined by Yell'
|
36
37
|
p.option 'only_4xx', '--only-4xx', 'Only reports errors for links that fall within the 4xx status code range'
|
@@ -67,6 +68,7 @@ Mercenary.program(:htmlproofer) do |p|
|
|
67
68
|
# FIXME: this is gross
|
68
69
|
options[:validation] = {}
|
69
70
|
options[:validation][:report_script_embeds] = opts['report_script_embeds']
|
71
|
+
options[:validation][:report_missing_names] = opts['report_missing_names']
|
70
72
|
options[:validation][:report_invalid_tags] = opts['report_invalid_tags']
|
71
73
|
|
72
74
|
options[:cache] = {}
|
@@ -2,6 +2,7 @@ class HtmlCheck < ::HTMLProofer::Check
|
|
2
2
|
SCRIPT_EMBEDS_MSG = /Element script embeds close tag/
|
3
3
|
INVALID_TAG_MSG = /Tag ([\w\-:]+) invalid/
|
4
4
|
INVALID_PREFIX = /Namespace prefix/
|
5
|
+
PARSE_ENTITY_REF = /htmlParseEntityRef: no name/
|
5
6
|
|
6
7
|
def run
|
7
8
|
@html.errors.each do |error|
|
@@ -12,6 +13,10 @@ class HtmlCheck < ::HTMLProofer::Check
|
|
12
13
|
next unless options[:validation][:report_invalid_tags]
|
13
14
|
end
|
14
15
|
|
16
|
+
if message =~ PARSE_ENTITY_REF
|
17
|
+
next unless options[:validation][:report_missing_names]
|
18
|
+
end
|
19
|
+
|
15
20
|
# tags embedded in scripts are used in templating languages: http://git.io/vOovv
|
16
21
|
next if !options[:validation][:report_script_embeds] && message =~ SCRIPT_EMBEDS_MSG
|
17
22
|
|
@@ -37,7 +37,7 @@ class ImageCheck < ::HTMLProofer::Check
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
if @img.alt.nil? || (empty_alt_tag? && !@img.ignore_empty_alt?)
|
40
|
+
if !@img.ignore_alt? && (@img.alt.nil? || (empty_alt_tag? && !@img.ignore_empty_alt?))
|
41
41
|
add_issue("image #{@img.url} does not have an alt attribute", line: line)
|
42
42
|
end
|
43
43
|
end
|
data/lib/html-proofer/element.rb
CHANGED
@@ -25,6 +25,7 @@ module HTMLProofer
|
|
25
25
|
# fix up missing protocols
|
26
26
|
@href.insert 0, 'http:' if @href =~ %r{^//}
|
27
27
|
@src.insert 0, 'http:' if @src =~ %r{^//}
|
28
|
+
@srcset.insert 0, 'http:' if @srcset =~ %r{^//}
|
28
29
|
end
|
29
30
|
|
30
31
|
def url
|
@@ -76,9 +77,9 @@ module HTMLProofer
|
|
76
77
|
|
77
78
|
# ignore user defined URLs
|
78
79
|
return true if ignores_pattern_check(@check.options[:url_ignore])
|
80
|
+
end
|
79
81
|
|
80
|
-
|
81
|
-
return false unless 'ImageCheck' == @type
|
82
|
+
def ignore_alt?
|
82
83
|
return true if ignores_pattern_check(@check.options[:alt_ignore])
|
83
84
|
end
|
84
85
|
|
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: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|