html-proofer 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html/proofer/check_runner.rb +42 -42
- data/lib/html/proofer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aee485ba8978958d84b407bcba3d7dd82fac38aa
|
4
|
+
data.tar.gz: ce729a21fe16f5490b0aebb16b913f82090c75a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2edea8968dabdca93daea01b7e8e0122b99139c710d3fc2ca138c8183dfd31984e39d979332dc62238b5f232e436a00a1b3bf57c5454e67687cb56182172dbeb
|
7
|
+
data.tar.gz: bb814a98dcb5d69e38c7b5205d2e504f727192988c3fa96c5df5c9886edcc200b8766c4349b392188f2bf9f0673414f60d4a1348e1eb3a272282d93eac8dd517
|
@@ -1,56 +1,56 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
module HTML
|
4
|
+
class Proofer
|
5
|
+
# Mostly handles issue management and collecting of external URLs.
|
6
|
+
class CheckRunner
|
7
|
+
|
8
|
+
attr_reader :issues, :src, :path, :options, :external_urls, :href_ignores, :alt_ignores
|
9
|
+
|
10
|
+
def initialize(src, path, html, opts={})
|
11
|
+
@src = src
|
12
|
+
@path = path
|
13
|
+
@html = remove_ignored(html)
|
14
|
+
@options = opts
|
15
|
+
@issues = []
|
16
|
+
@href_ignores = @options[:href_ignore]
|
17
|
+
@alt_ignores = @options[:alt_ignore]
|
18
|
+
@external_urls = {}
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
def run
|
22
|
+
fail NotImplementedError, 'HTML::Proofer::CheckRunner subclasses must implement #run'
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def add_issue(desc, line_number = nil, status = -1)
|
26
|
+
@issues << Issue.new(@path, desc, line_number, status)
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
def add_to_external_urls(href)
|
30
|
+
if @external_urls[href]
|
31
|
+
@external_urls[href] << @path
|
32
|
+
else
|
33
|
+
@external_urls[href] = [@path]
|
34
|
+
end
|
34
35
|
end
|
35
|
-
end
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
def self.checks
|
38
|
+
classes = []
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
ObjectSpace.each_object(Class) do |c|
|
41
|
+
next unless c.superclass == self
|
42
|
+
classes << c
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
classes
|
46
|
+
end
|
47
47
|
|
48
|
-
|
48
|
+
private
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
def remove_ignored(html)
|
51
|
+
html.css('code, pre').each(&:unlink)
|
52
|
+
html
|
53
|
+
end
|
53
54
|
end
|
54
|
-
|
55
55
|
end
|
56
56
|
end
|
data/lib/html/proofer/version.rb
CHANGED