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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af419279efbdd381866a4bd46f230e7d5d2c4fdb
4
- data.tar.gz: 7927600634fc32d291327b387738c66f16685362
3
+ metadata.gz: b26505bd1c7a6f0632a95f2bb1718ae9e2bae90f
4
+ data.tar.gz: c8cbb29407b3eedcd997f8e9226323c6e4a55dc3
5
5
  SHA512:
6
- metadata.gz: 966bc174bbaf591880bea6e905a0c51c79f5d025f7956ac9e133dac08740ac5e2206bfa915d7574aa67bf9b7b6952800335abaf883b1c9d12d83c4cf1f49ecf2
7
- data.tar.gz: 09c8d6ef8d75644b0e4e5383a67886cd38df6f90b22ecfbbf502e1a4b942e353cc5fb09c918cb67937dd079b46812f9b01a0ac65667bb5cb6e572fc1022dfdfd
6
+ metadata.gz: 1432ff5ff5ad2c0eeb1ef40b66f46608f0d737e39474f2e8185614ca6ede77af17fd4dd1893fa86fa12bf2c6f9c2c12b19a5713044b99cc705f2a43e236e57be
7
+ data.tar.gz: 0f1a23a1534ef863223808efb54dcb493ebb04a51a1793fd25f3875d89e891a19e8beea085791947bee5791a93baa68f4dc2048406acc71b822477b28cef7d6a
@@ -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
@@ -40,6 +40,7 @@ module HTMLProofer
40
40
 
41
41
  VALIDATION_DEFAULTS = {
42
42
  :report_script_embeds => false,
43
+ :report_missing_names => false,
43
44
  :report_invalid_tags => false
44
45
  }
45
46
 
@@ -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
- # ignore user defined alts
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
 
@@ -1,3 +1,3 @@
1
1
  module HTMLProofer
2
- VERSION = '3.0.5'
2
+ VERSION = '3.0.6'
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.0.5
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-04-01 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mercenary