html-proofer 3.18.8 → 3.19.3

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: d705eda2b6ad497d076f1dfa565e5c98e0769b9cd83ddee56ab04b8d4ad6722f
4
- data.tar.gz: 74d2ca4e6b65e8f1d1467aef9cae90a4804cb285eecf8a5014e8b77c579ef25b
3
+ metadata.gz: c2b4d8267ba11055f2b4d9da7b9367dfddca14c9438bb50d1e501fc5f554ae78
4
+ data.tar.gz: 0cac83b1b517f551bcc92c29da4fbecf6af3c75a5968651e4a89b11600959ce9
5
5
  SHA512:
6
- metadata.gz: b51003f4125230780bc0335f72148e7b4c964aba772b16cdcfb5bcad941eea7eb0ce428cd8b0d78ebcf08fe2e049b4850fbd4e85f90e57b56b1b854bfb516408
7
- data.tar.gz: 2bc6deafa255f91f210bdfc0df14c8aac36f16bff90e2402b4a0657a1ed68ad7c60b4717bdceaff4a819764104a05da6c95e049c83cb83d3f518e83a6638d14b
6
+ metadata.gz: 97b53efb1b177d460ff721a2558b582c89a616eae171212056979fc03a2f95ee21ecc887865794580830c42d3ad73b4ab32fc9c99d442edea429f38f810baab5
7
+ data.tar.gz: e9c005e2def8641531efc6c8e64f69eb980c0ce8bdf096dd13e93856546c9ab97f205c27bf20b709e741f1053a13b8f34b1325cb35dd9db7af44eb56635fca27
data/bin/htmlproofer CHANGED
@@ -37,6 +37,7 @@ Mercenary.program(:htmlproofer) do |p|
37
37
  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'
38
38
  p.option 'http_status_ignore', '--http-status-ignore 123,[xxx, ...]', Array, 'A comma-separated list of numbers representing status codes to ignore.'
39
39
  p.option 'internal_domains', '--internal-domains domain1,[domain2,...]', Array, 'A comma-separated list of Strings containing domains that will be treated as internal urls.'
40
+ p.option 'ignore_empty_mailto', '--ignore-empty-mailto', 'If `true`, allows `mailto:` `href`s which do not contain an email address'
40
41
  p.option 'report_invalid_tags', '--report-invalid-tags', 'When `check_html` is enabled, HTML markup that is unknown to Nokogumbo are reported as errors (default: `false`)'
41
42
  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
43
  p.option 'report_script_embeds', '--report-script-embeds', 'When `check_html` is enabled, `script` tags containing markup are reported as errors (default: `false`)'
@@ -48,6 +49,7 @@ Mercenary.program(:htmlproofer) do |p|
48
49
  p.option 'storage_dir', '--storage-dir PATH', String, 'Directory where to store the cache log (default: "tmp/.htmlproofer")'
49
50
  p.option 'timeframe', '--timeframe <time>', String, 'A string representing the caching timeframe.'
50
51
  p.option 'typhoeus_config', '--typhoeus-config CONFIG', String, 'JSON-formatted string of Typhoeus config. Will override the html-proofer defaults.'
52
+ p.option 'hydra_config', '--hydra-config CONFIG', String, 'JSON-formatted string of Hydra config. Will override the html-proofer defaults.'
51
53
  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'
52
54
  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.'
53
55
  p.option 'root_dir', '--root-dir PATH', String, 'The absolute path to the directory serving your html-files.'
@@ -87,7 +89,8 @@ Mercenary.program(:htmlproofer) do |p|
87
89
  options[:validation][:report_eof_tags] = opts['report_eof_tags'] unless opts['report_eof_tags'].nil?
88
90
  options[:validation][:report_mismatched_tags] = opts['report_mismatched_tags'] unless opts['report_mismatched_tags'].nil?
89
91
 
90
- options[:typhoeus] = HTMLProofer::Configuration.parse_json_option('typhoeus_config', opts['typhoeus_config']) unless opts['typhoeus_config'].nil?
92
+ options[:typhoeus] = HTMLProofer::Configuration.parse_json_option('typhoeus_config', opts['typhoeus_config'], symbolize_names: false) unless opts['typhoeus_config'].nil?
93
+ options[:hydra] = HTMLProofer::Configuration.parse_json_option('hydra_config', opts['hydra_config']) unless opts['hydra_config'].nil?
91
94
 
92
95
  unless opts['timeframe'].nil?
93
96
  options[:cache] ||= {}
@@ -178,7 +178,7 @@ module HTMLProofer
178
178
  when :months
179
179
  @cache_datetime >> -measurement
180
180
  when :weeks
181
- @cache_datetime - measurement * 7
181
+ @cache_datetime - (measurement * 7)
182
182
  when :days
183
183
  @cache_datetime - measurement
184
184
  when :hours
@@ -95,7 +95,7 @@ class LinkCheck < ::HTMLProofer::Check
95
95
 
96
96
  def handle_mailto(link, line, content)
97
97
  if link.path.empty?
98
- add_issue("#{link.href} contains no email address", line: line, content: content)
98
+ add_issue("#{link.href} contains no email address", line: line, content: content) unless link.ignore_empty_mailto?
99
99
  elsif !link.path.include?('@')
100
100
  add_issue("#{link.href} contains an invalid email address", line: line, content: content)
101
101
  end
@@ -27,6 +27,7 @@ module HTMLProofer
27
27
  http_status_ignore: [],
28
28
  internal_domains: [],
29
29
  log_level: :info,
30
+ ignore_empty_mailto: false,
30
31
  only_4xx: false,
31
32
  url_ignore: [],
32
33
  url_swap: {}
@@ -67,7 +68,7 @@ module HTMLProofer
67
68
  end
68
69
  end
69
70
 
70
- def self.parse_json_option(option_name, config)
71
+ def self.parse_json_option(option_name, config, symbolize_names: true)
71
72
  raise ArgumentError, 'Must provide an option name in string format.' unless option_name.is_a?(String)
72
73
  raise ArgumentError, 'Must provide an option name in string format.' if option_name.strip.empty?
73
74
 
@@ -78,7 +79,7 @@ module HTMLProofer
78
79
  return {} if config.strip.empty?
79
80
 
80
81
  begin
81
- JSON.parse(config)
82
+ JSON.parse(config, { symbolize_names: symbolize_names })
82
83
  rescue StandardError
83
84
  raise ArgumentError, "Option '#{option_name} did not contain valid JSON."
84
85
  end
@@ -142,6 +142,10 @@ module HTMLProofer
142
142
  @check.options[:check_sri]
143
143
  end
144
144
 
145
+ def ignore_empty_mailto?
146
+ @check.options[:ignore_empty_mailto]
147
+ end
148
+
145
149
  # path is external to the file
146
150
  def external?
147
151
  !internal?
@@ -53,6 +53,7 @@ module HTMLProofer
53
53
  if @failures.empty?
54
54
  @logger.log :info, 'HTML-Proofer finished successfully.'
55
55
  else
56
+ @failures.uniq!
56
57
  print_failed_tests
57
58
  end
58
59
  end
@@ -125,7 +126,7 @@ module HTMLProofer
125
126
  end
126
127
 
127
128
  external_urls = check.external_urls
128
- external_urls = check.external_urls.map { |url, file| [swap(url, @options[:url_swap]), file] }.to_h if @options[:url_swap]
129
+ external_urls = check.external_urls.transform_keys { |url| swap(url, @options[:url_swap]) } if @options[:url_swap]
129
130
  result[:external_urls].merge!(external_urls)
130
131
  result[:failures].concat(check.issues)
131
132
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'nokogumbo'
3
+ require 'nokogiri'
4
4
 
5
5
  module HTMLProofer
6
6
  module Utils
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = '3.18.8'
4
+ VERSION = '3.19.3'
5
5
  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.18.8
4
+ version: 3.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2021-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.3'
41
41
  - !ruby/object:Gem::Dependency
42
- name: nokogumbo
42
+ name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '1.12'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '1.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: parallel
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -287,7 +287,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
287
287
  requirements:
288
288
  - - ">="
289
289
  - !ruby/object:Gem::Version
290
- version: 2.4.10
290
+ version: 2.6.0
291
291
  - - "<"
292
292
  - !ruby/object:Gem::Version
293
293
  version: '4.0'
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  - !ruby/object:Gem::Version
298
298
  version: '0'
299
299
  requirements: []
300
- rubygems_version: 3.1.4
300
+ rubygems_version: 3.2.33
301
301
  signing_key:
302
302
  specification_version: 4
303
303
  summary: A set of tests to validate your HTML output. These tests check if your image