html-proofer 2.6.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/{htmlproof → htmlproofer} +31 -24
- data/lib/html-proofer.rb +47 -0
- data/lib/html-proofer/cache.rb +153 -0
- data/lib/html-proofer/check.rb +63 -0
- data/lib/{html/proofer/checks → html-proofer/check}/favicon.rb +2 -8
- data/lib/html-proofer/check/html.rb +21 -0
- data/lib/html-proofer/check/images.rb +47 -0
- data/lib/{html/proofer/checks → html-proofer/check}/links.rb +40 -48
- data/lib/html-proofer/check/scripts.rb +28 -0
- data/lib/html-proofer/configuration.rb +56 -0
- data/lib/html-proofer/element.rb +165 -0
- data/lib/{html/proofer/check_runner → html-proofer}/issue.rb +8 -10
- data/lib/html-proofer/log.rb +49 -0
- data/lib/html-proofer/runner.rb +160 -0
- data/lib/html-proofer/url_validator.rb +218 -0
- data/lib/html-proofer/utils.rb +40 -0
- data/lib/html-proofer/version.rb +3 -0
- metadata +20 -20
- data/lib/html/proofer.rb +0 -191
- data/lib/html/proofer/cache.rb +0 -141
- data/lib/html/proofer/check_runner.rb +0 -70
- data/lib/html/proofer/checkable.rb +0 -168
- data/lib/html/proofer/checks/html.rb +0 -46
- data/lib/html/proofer/checks/images.rb +0 -54
- data/lib/html/proofer/checks/scripts.rb +0 -40
- data/lib/html/proofer/configuration.rb +0 -48
- data/lib/html/proofer/log.rb +0 -42
- data/lib/html/proofer/url_validator.rb +0 -222
- data/lib/html/proofer/utils.rb +0 -42
- data/lib/html/proofer/version.rb +0 -5
- data/lib/html/proofer/xpathfunctions.rb +0 -9
data/lib/html/proofer/utils.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
|
-
module HTML
|
4
|
-
class Proofer
|
5
|
-
module Utils
|
6
|
-
STORAGE_DIR = File.join('tmp', '.htmlproofer')
|
7
|
-
|
8
|
-
def pluralize(count, single, plural)
|
9
|
-
"#{count} " << (count == 1 ? single : plural)
|
10
|
-
end
|
11
|
-
|
12
|
-
def create_nokogiri(path)
|
13
|
-
if File.exist? path
|
14
|
-
content = File.open(path).read
|
15
|
-
else
|
16
|
-
content = path
|
17
|
-
end
|
18
|
-
|
19
|
-
Nokogiri::HTML(clean_content(content))
|
20
|
-
end
|
21
|
-
module_function :create_nokogiri
|
22
|
-
|
23
|
-
def swap(href, replacement)
|
24
|
-
replacement.each do |link, replace|
|
25
|
-
href = href.gsub(link, replace)
|
26
|
-
end
|
27
|
-
href
|
28
|
-
end
|
29
|
-
module_function :swap
|
30
|
-
|
31
|
-
# address a problem with Nokogiri's parsing URL entities
|
32
|
-
# problem from http://git.io/vBYU1
|
33
|
-
# solution from http://git.io/vBYUi
|
34
|
-
def clean_content(string)
|
35
|
-
string.gsub(%r{https?://([^>]+)}i) do |url|
|
36
|
-
url.gsub(/&(?!amp;)/, '&')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
module_function :clean_content
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/html/proofer/version.rb
DELETED