html-proofer 3.8.0 → 3.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbaac895cc16c29554e70a2640f654087f7f6bfa
4
- data.tar.gz: d0705afd3249cc486bd6de557edb479ea976d15d
3
+ metadata.gz: d6d2dd931b1f249cc7db758f4ebff9416bbb1a3f
4
+ data.tar.gz: e8cc4b3267a2e5b1a7479b164e9570a486797e02
5
5
  SHA512:
6
- metadata.gz: b429b5ab045115c0d8a1ac7e527b7240be21650ddf8dcc09f71c3669345a5a0b4e6d43be2174ae8dfc882b3fa33760561e5d8b4e9c93fdab4d8a0d03709c97a8
7
- data.tar.gz: 40ccce6b3054b72099e6dfd4db6219dca204dae3fcd8f0301e27870d92392289493aa99f62e9279357464bcd1434c9b18d7797fefcdc4ffeb090e0382ddf5986
6
+ metadata.gz: ecdb65f032782248c8ed47fee04332c6fe4753f84ead430cf5f7a7eb27b79021b7db08571e876c8989ae4cc7d14832d1492edc6e6cc6c74431a05f3cc621ecab
7
+ data.tar.gz: 2368c979d01c4e6159a89650b11045e35e73c02e5e2892a5de522cba95b77566030ca80424dbf61ca7c68f819b3bdb8fb218545020050fa7327d4979aee0dfc4
data/bin/htmlproofer CHANGED
@@ -13,6 +13,7 @@ Mercenary.program(:htmlproofer) do |p|
13
13
 
14
14
  p.description 'Runs the HTML-Proofer suite on the files in PATH. For more details, see the README.'
15
15
 
16
+ p.option 'allow_missing_href', '--allow-missing-href', 'If `true`, does not flag `a` tags missing `href` (this is the default for HTML5).'
16
17
  p.option 'allow_hash_href', '--allow-hash-href', 'If `true`, ignores the `href` `#`'
17
18
  p.option 'as_links', '--as-links', 'Assumes that `PATH` is a comma-separated array of links to check.'
18
19
  p.option 'alt_ignore', '--alt-ignore image1,[image2,...]', Array, 'A comma-separated list of Strings or RegExps containing `img`s whose missing `alt` tags are safe to ignore'
data/lib/html-proofer.rb CHANGED
@@ -1,5 +1,3 @@
1
- # rubocop:disable Style/FileName
2
-
3
1
  def require_all(path)
4
2
  dir = File.join(File.dirname(__FILE__), path)
5
3
  Dir[File.join(dir, '*.rb')].each do |f|
@@ -30,6 +30,7 @@ class LinkCheck < ::HTMLProofer::Check
30
30
 
31
31
  # is there even an href?
32
32
  if missing_href?
33
+ next if @link.allow_missing_href?
33
34
  # HTML5 allows dropping the href: http://git.io/vBX0z
34
35
  next if @html.internal_subset.name == 'html' && @html.internal_subset.external_id.nil?
35
36
  add_issue('anchor has no href attribute', line: line, content: content)
@@ -3,6 +3,7 @@ module HTMLProofer
3
3
  require_relative 'version'
4
4
 
5
5
  PROOFER_DEFAULTS = {
6
+ allow_missing_href: false,
6
7
  allow_hash_href: false,
7
8
  alt_ignore: [],
8
9
  assume_extension: false,
@@ -114,6 +114,10 @@ module HTMLProofer
114
114
  @check.options[:empty_alt_ignore]
115
115
  end
116
116
 
117
+ def allow_missing_href?
118
+ @check.options[:allow_missing_href]
119
+ end
120
+
117
121
  def allow_hash_href?
118
122
  @check.options[:allow_hash_href]
119
123
  end
@@ -1,3 +1,3 @@
1
1
  module HTMLProofer
2
- VERSION = '3.8.0'.freeze
2
+ VERSION = '3.9.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.8.0
4
+ version: 3.9.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-01-05 00:00:00.000000000 Z
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mercenary