html-proofer 3.15.1 → 3.15.2
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 +4 -0
- data/lib/html-proofer/check.rb +3 -2
- data/lib/html-proofer/check/html.rb +7 -1
- data/lib/html-proofer/check/opengraph.rb +3 -3
- data/lib/html-proofer/configuration.rb +3 -1
- data/lib/html-proofer/element.rb +11 -5
- data/lib/html-proofer/middleware.rb +2 -1
- data/lib/html-proofer/runner.rb +3 -1
- data/lib/html-proofer/utils.rb +1 -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: d96b191b03d99b1d4fac61814a324dc0e46d69073318591fce74077dd484b512
|
4
|
+
data.tar.gz: 35bb1cd3d4ab1666c699b144afca8c20860db957156610a78d83f1f25154fde2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e3e8e502e52aff8e11aa917232cf288be5afcfea255b5b5bdfef61ef327e8d2899a4c394ba529fc13f6e246fa1523650d3689205f68c9f4cfd005077c4f2a4
|
7
|
+
data.tar.gz: d33bacd4efe1d0f6fee8eeb4d3491738b7d82a840e43fac77374a019319dc099e75d7e4d6440e3ed0dcba6b2c42d78178dd18351289fb2f8f4a9d32cad185353
|
data/bin/htmlproofer
CHANGED
@@ -41,6 +41,8 @@ Mercenary.program(:htmlproofer) do |p|
|
|
41
41
|
p.option 'report_missing_names', '--report-missing-names', 'When `check_html` is enabled, HTML markup that are missing entity names are reported as errors (default: `false`)'
|
42
42
|
p.option 'report_script_embeds', '--report-script-embeds', 'When `check_html` is enabled, `script` tags containing markup are reported as errors (default: `false`)'
|
43
43
|
p.option 'report_missing_doctype', '--report-missing-doctype', 'When `check_html` is enabled, HTML markup with missing or out-of-order `DOCTYPE` are reported as errors (default: `false`)'
|
44
|
+
p.option 'report_eof_tags', '--report-eof-tags', 'When `check_html` is enabled, HTML markup with tags that are malformed are reported as errors (default: `false`)'
|
45
|
+
p.option 'report_mismatched_tags', '--report-mismatched-tags', 'When `check_html` is enabled, HTML markup with mismatched tags are reported as errors (default: `false`)'
|
44
46
|
p.option 'log_level', '--log-level <level>', String, 'Sets the logging level, as determined by Yell. One of `:debug`, `:info`, `:warn`, `:error`, or `:fatal`. (default: `:info`)'
|
45
47
|
p.option 'only_4xx', '--only-4xx', 'Only reports errors for links that fall within the 4xx status code range'
|
46
48
|
p.option 'storage_dir', '--storage-dir PATH', String, 'Directory where to store the cache log (default: "tmp/.htmlproofer")'
|
@@ -82,6 +84,8 @@ Mercenary.program(:htmlproofer) do |p|
|
|
82
84
|
options[:validation][:report_missing_names] = opts['report_missing_names'] unless opts['report_missing_names'].nil?
|
83
85
|
options[:validation][:report_invalid_tags] = opts['report_invalid_tags'] unless opts['report_invalid_tags'].nil?
|
84
86
|
options[:validation][:report_missing_doctype] = opts['report_missing_doctype'] unless opts['report_missing_doctype'].nil?
|
87
|
+
options[:validation][:report_eof_tags] = opts['report_eof_tags'] unless opts['report_eof_tags'].nil?
|
88
|
+
options[:validation][:report_mismatched_tags] = opts['report_mismatched_tags'] unless opts['report_mismatched_tags'].nil?
|
85
89
|
|
86
90
|
options[:typhoeus] = HTMLProofer::Configuration.parse_json_option('typhoeus_config', opts['typhoeus_config']) unless opts['typhoeus_config'].nil?
|
87
91
|
|
data/lib/html-proofer/check.rb
CHANGED
@@ -5,10 +5,11 @@ module HTMLProofer
|
|
5
5
|
class Check
|
6
6
|
attr_reader :node, :html, :element, :src, :path, :options, :issues, :external_urls
|
7
7
|
|
8
|
-
def initialize(src, path, html, options)
|
8
|
+
def initialize(src, path, html, logger, options)
|
9
9
|
@src = src
|
10
10
|
@path = path
|
11
11
|
@html = remove_ignored(html)
|
12
|
+
@logger = logger
|
12
13
|
@options = options
|
13
14
|
@issues = []
|
14
15
|
@external_urls = {}
|
@@ -16,7 +17,7 @@ module HTMLProofer
|
|
16
17
|
|
17
18
|
def create_element(node)
|
18
19
|
@node = node
|
19
|
-
Element.new(node, self)
|
20
|
+
Element.new(node, self, @logger)
|
20
21
|
end
|
21
22
|
|
22
23
|
def run
|
@@ -6,7 +6,9 @@ class HtmlCheck < ::HTMLProofer::Check
|
|
6
6
|
INVALID_TAG_MSG = /Tag ([\w\-:]+) invalid/.freeze
|
7
7
|
INVALID_PREFIX = /Namespace prefix/.freeze
|
8
8
|
PARSE_ENTITY_REF = /htmlParseEntityRef: no name/.freeze
|
9
|
-
DOCTYPE_MSG = /
|
9
|
+
DOCTYPE_MSG = /Expected a doctype token/.freeze
|
10
|
+
EOF_IN_TAG = /End of input in tag/.freeze
|
11
|
+
MISMATCHED_TAGS = /That tag isn't allowed here/.freeze
|
10
12
|
|
11
13
|
def run
|
12
14
|
@html.errors.each do |error|
|
@@ -24,6 +26,10 @@ class HtmlCheck < ::HTMLProofer::Check
|
|
24
26
|
options[:validation][:report_missing_names]
|
25
27
|
when DOCTYPE_MSG
|
26
28
|
options[:validation][:report_missing_doctype]
|
29
|
+
when EOF_IN_TAG
|
30
|
+
options[:validation][:report_eof_tags]
|
31
|
+
when MISMATCHED_TAGS
|
32
|
+
options[:validation][:report_mismatched_tags]
|
27
33
|
else
|
28
34
|
true
|
29
35
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
class OpenGraphElement < ::HTMLProofer::Element
|
4
4
|
attr_reader :src
|
5
5
|
|
6
|
-
def initialize(obj, check)
|
7
|
-
super(obj, check)
|
6
|
+
def initialize(obj, check, logger)
|
7
|
+
super(obj, check, logger)
|
8
8
|
# Fake up src from the content attribute
|
9
9
|
instance_variable_set('@src', @content)
|
10
10
|
|
@@ -23,7 +23,7 @@ class OpenGraphCheck < ::HTMLProofer::Check
|
|
23
23
|
|
24
24
|
def run
|
25
25
|
@html.css('meta[property="og:url"], meta[property="og:image"]').each do |m|
|
26
|
-
@opengraph = OpenGraphElement.new(m, self)
|
26
|
+
@opengraph = OpenGraphElement.new(m, self, @logger)
|
27
27
|
|
28
28
|
next if @opengraph.ignore?
|
29
29
|
|
@@ -52,7 +52,9 @@ module HTMLProofer
|
|
52
52
|
report_script_embeds: false,
|
53
53
|
report_missing_names: false,
|
54
54
|
report_invalid_tags: false,
|
55
|
-
report_missing_doctype: false
|
55
|
+
report_missing_doctype: false,
|
56
|
+
report_eof_tags: false,
|
57
|
+
report_mismatched_tags: false
|
56
58
|
}.freeze
|
57
59
|
|
58
60
|
CACHE_DEFAULTS = {}.freeze
|
data/lib/html-proofer/element.rb
CHANGED
@@ -10,12 +10,18 @@ module HTMLProofer
|
|
10
10
|
|
11
11
|
attr_reader :id, :name, :alt, :href, :link, :src, :line, :data_proofer_ignore
|
12
12
|
|
13
|
-
def initialize(obj, check)
|
13
|
+
def initialize(obj, check, logger)
|
14
|
+
@logger = logger
|
14
15
|
# Construct readable ivars for every element
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
begin
|
17
|
+
obj.attributes.each_pair do |attribute, value|
|
18
|
+
name = attribute.tr('-:.;', '_').to_s.to_sym
|
19
|
+
(class << self; self; end).send(:attr_reader, name)
|
20
|
+
instance_variable_set("@#{name}", value.value)
|
21
|
+
end
|
22
|
+
rescue NameError => e
|
23
|
+
@logger.log :error, "Attribute set `#{obj}` contains an error!"
|
24
|
+
raise e
|
19
25
|
end
|
20
26
|
|
21
27
|
@aria_hidden = defined?(@aria_hidden) && @aria_hidden == 'true' ? true : false
|
@@ -21,7 +21,8 @@ module HTMLProofer
|
|
21
21
|
allow_hash_href: true,
|
22
22
|
check_external_hash: true,
|
23
23
|
check_html: true,
|
24
|
-
url_ignore: [/.*/] # Don't try to check local files exist
|
24
|
+
url_ignore: [/.*/], # Don't try to check if local files exist
|
25
|
+
validation: { report_eof_tags: true }
|
25
26
|
}
|
26
27
|
end
|
27
28
|
|
data/lib/html-proofer/runner.rb
CHANGED
@@ -100,7 +100,7 @@ module HTMLProofer
|
|
100
100
|
@src.each do |src|
|
101
101
|
checks.each do |klass|
|
102
102
|
@logger.log :debug, "Checking #{klass.to_s.downcase} on #{path} ..."
|
103
|
-
check = Object.const_get(klass).new(src, path, html, @options)
|
103
|
+
check = Object.const_get(klass).new(src, path, html, @logger, @options)
|
104
104
|
check.run
|
105
105
|
external_urls = check.external_urls
|
106
106
|
external_urls = Hash[check.external_urls.map { |url, file| [swap(url, @options[:url_swap]), file] }] if @options[:url_swap]
|
@@ -147,6 +147,8 @@ module HTMLProofer
|
|
147
147
|
def checks
|
148
148
|
return @checks if defined?(@checks) && !@checks.nil?
|
149
149
|
|
150
|
+
return (@checks = ['LinkCheck']) if @type == :links
|
151
|
+
|
150
152
|
@checks = HTMLProofer::Check.subchecks.map(&:name)
|
151
153
|
@checks.delete('FaviconCheck') unless @options[:check_favicon]
|
152
154
|
@checks.delete('HtmlCheck') unless @options[:check_html]
|
data/lib/html-proofer/utils.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: 3.15.
|
4
|
+
version: 3.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -308,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
308
|
- !ruby/object:Gem::Version
|
309
309
|
version: '0'
|
310
310
|
requirements: []
|
311
|
-
rubygems_version: 3.
|
311
|
+
rubygems_version: 3.1.2
|
312
312
|
signing_key:
|
313
313
|
specification_version: 4
|
314
314
|
summary: A set of tests to validate your HTML output. These tests check if your image
|