html-proofer 3.9.3 → 3.10.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/bin/htmlproofer +6 -2
- data/lib/html-proofer/check/links.rb +1 -1
- data/lib/html-proofer/configuration.rb +17 -0
- data/lib/html-proofer/element.rb +3 -4
- data/lib/html-proofer/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b45b89b9e969d7559aa5006e53ff2b363fd7e1aeed1178366c30656696696e61
|
4
|
+
data.tar.gz: 756470e2c29749f59accaed01ff8b64bef731fa06c20ec6995a76ee8a3f1fe9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616c50dff0b36c1fac958985eb6d8fe22278a38abfd2701779b270268836e104bc0d25856a3fef1546644cc27fe04be3ee99172c4c6069189d41fbaf94af8b24
|
7
|
+
data.tar.gz: 02b0c9dfe2deb801d2cea99923791b5eb212bcf2f28ee1096c7599367406bfe40cf7d090f905f174746ac9aa3004219d8b34ae9e2490d72971fbd287a732d41c
|
data/bin/htmlproofer
CHANGED
@@ -34,16 +34,17 @@ Mercenary.program(:htmlproofer) do |p|
|
|
34
34
|
p.option 'external_only', '--external_only', 'Only checks problems with external references'
|
35
35
|
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'
|
36
36
|
p.option 'http_status_ignore', '--http-status-ignore 123,[xxx, ...]', Array, 'A comma-separated list of numbers representing status codes to ignore.'
|
37
|
+
p.option 'internal_domains', '--internal-domains domain1,[domain2,...]', Array, 'A comma-separated list of Strings containing domains that will be treated as internal urls.'
|
37
38
|
p.option 'report_invalid_tags', '--report-invalid-tags', 'Ignore `check_html` errors associated with unknown markup (default: `false`)'
|
38
39
|
p.option 'report_missing_names', '--report-missing-names', 'Ignore `check_html` errors associated with missing entities (default: `false`)'
|
39
40
|
p.option 'report_script_embeds', '--report-script-embeds', 'Ignore `check_html` errors associated with `script`s (default: `false`)'
|
40
41
|
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`)'
|
41
42
|
p.option 'only_4xx', '--only-4xx', 'Only reports errors for links that fall within the 4xx status code range'
|
43
|
+
p.option 'storage_dir', '--storage-dir PATH', String, 'Directory where to store the cache log (default: "tmp/.htmlproofer")'
|
42
44
|
p.option 'timeframe', '--timeframe <time>', String, 'A string representing the caching timeframe.'
|
45
|
+
p.option 'typhoeus_config', '--typhoeus-config CONFIG', String, 'JSON-formatted string of Typhoeus config. Will override the html-proofer defaults.'
|
43
46
|
p.option 'url_ignore', '--url-ignore link1,[link2,...]', Array, 'A comma-separated list of Strings or RegExps containing URLs that are safe to ignore. It affects all HTML attributes. Note that non-HTTP(S) URIs are always ignored'
|
44
47
|
p.option 'url_swap', '--url-swap re:string,[re:string,...]', Array, 'A comma-separated list containing key-value pairs of `RegExp => String`. It transforms URLs that match `RegExp` into `String` via `gsub`. The escape sequences `\\:` should be used to produce literal `:`s.'
|
45
|
-
p.option 'internal_domains', '--internal-domains domain1,[domain2,...]', Array, 'A comma-separated list of Strings containing domains that will be treated as internal urls.'
|
46
|
-
p.option 'storage_dir', '--storage-dir PATH', String, 'Directory where to store the cache log (default: "tmp/.htmlproofer")'
|
47
48
|
|
48
49
|
p.action do |args, opts|
|
49
50
|
args = ['.'] if args.empty?
|
@@ -80,6 +81,9 @@ Mercenary.program(:htmlproofer) do |p|
|
|
80
81
|
options[:validation][:report_missing_names] = opts['report_missing_names']
|
81
82
|
options[:validation][:report_invalid_tags] = opts['report_invalid_tags']
|
82
83
|
|
84
|
+
options[:typhoeus] = {}
|
85
|
+
options[:typhoeus] = HTMLProofer::Configuration.parse_json_option('typhoeus_config', opts['typhoeus_config'])
|
86
|
+
|
83
87
|
options[:cache] = {}
|
84
88
|
options[:cache][:timeframe] = opts['timeframe'] unless opts['timeframe'].nil?
|
85
89
|
options[:cache][:storage_dir] = opts['storage_dir'] unless opts['storage_dir'].nil?
|
@@ -127,7 +127,7 @@ class LinkCheck < ::HTMLProofer::Check
|
|
127
127
|
html.xpath(*xpaths)
|
128
128
|
end
|
129
129
|
|
130
|
-
IGNORABE_REL = %(canonical alternate icon manifest apple-touch-icon)
|
130
|
+
IGNORABE_REL = %(canonical alternate next prev previous icon manifest apple-touch-icon)
|
131
131
|
|
132
132
|
def check_sri(line, content)
|
133
133
|
return if IGNORABE_REL.include?(@link.rel)
|
@@ -61,5 +61,22 @@ module HTMLProofer
|
|
61
61
|
item
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
def self.parse_json_option(option_name, config)
|
66
|
+
raise ArgumentError.new('Must provide an option name in string format.') unless option_name.is_a?(String)
|
67
|
+
raise ArgumentError.new('Must provide an option name in string format.') unless !option_name.strip.empty?
|
68
|
+
|
69
|
+
return {} if config.nil?
|
70
|
+
|
71
|
+
raise ArgumentError.new('Must provide a JSON configuration in string format.') unless config.is_a?(String)
|
72
|
+
|
73
|
+
return {} if config.strip.empty?
|
74
|
+
|
75
|
+
begin
|
76
|
+
JSON.parse(config)
|
77
|
+
rescue
|
78
|
+
raise ArgumentError.new("Option '" + option_name + "' did not contain valid JSON.")
|
79
|
+
end
|
80
|
+
end
|
64
81
|
end
|
65
82
|
end
|
data/lib/html-proofer/element.rb
CHANGED
@@ -173,11 +173,10 @@ module HTMLProofer
|
|
173
173
|
|
174
174
|
file = File.join base, path
|
175
175
|
|
176
|
-
|
177
|
-
if File.directory?(file) && !unslashed_directory?(file)
|
178
|
-
file = File.join file, @check.options[:directory_index_file]
|
179
|
-
elsif @check.options[:assume_extension] && File.file?("#{file}#{@check.options[:extension]}")
|
176
|
+
if @check.options[:assume_extension] && File.file?("#{file}#{@check.options[:extension]}")
|
180
177
|
file = "#{file}#{@check.options[:extension]}"
|
178
|
+
elsif File.directory?(file) && !unslashed_directory?(file) # implicit index support
|
179
|
+
file = File.join file, @check.options[:directory_index_file]
|
181
180
|
end
|
182
181
|
|
183
182
|
file
|
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.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: '1.9'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: '1.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: colorize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|