html-proofer 3.9.3 → 3.10.0

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: 246e851f166c3330542ef13670c9b86ea6acef06b142de26692ae16ec421dd15
4
- data.tar.gz: 6e63ce9f51b36817a9420ef07dd7a40c5668227f94ffc01df4cf3d8ac21fdb1e
3
+ metadata.gz: b45b89b9e969d7559aa5006e53ff2b363fd7e1aeed1178366c30656696696e61
4
+ data.tar.gz: 756470e2c29749f59accaed01ff8b64bef731fa06c20ec6995a76ee8a3f1fe9b
5
5
  SHA512:
6
- metadata.gz: 19a3a97c74d2c9fddbbb4b12cbc38e9ab08309232c876ccaab922643de9535f0ebf9d56a90a3ce0c4821cd070d5b629ef4368629e2e5b2c6a02c36acb5019e3a
7
- data.tar.gz: e2201edf4fee55ed6b80b00e7bbdb5eb272a8fc5748d1bcd41148e3afa7757e24487c5698e12083288aeefc2a5e7db317d8fd29b5340d5678d9c14fe2b327381
6
+ metadata.gz: 616c50dff0b36c1fac958985eb6d8fe22278a38abfd2701779b270268836e104bc0d25856a3fef1546644cc27fe04be3ee99172c4c6069189d41fbaf94af8b24
7
+ data.tar.gz: 02b0c9dfe2deb801d2cea99923791b5eb212bcf2f28ee1096c7599367406bfe40cf7d090f905f174746ac9aa3004219d8b34ae9e2490d72971fbd287a732d41c
@@ -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
@@ -173,11 +173,10 @@ module HTMLProofer
173
173
 
174
174
  file = File.join base, path
175
175
 
176
- # implicit index support
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
@@ -1,3 +1,3 @@
1
1
  module HTMLProofer
2
- VERSION = '3.9.3'.freeze
2
+ VERSION = '3.10.0'.freeze
3
3
  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: 3.9.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: 2018-11-28 00:00:00.000000000 Z
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.8.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.8.1
40
+ version: '1.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement