html-proofer 3.17.0 → 3.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/htmlproofer +1 -1
- data/lib/html-proofer/element.rb +18 -19
- data/lib/html-proofer/runner.rb +1 -1
- data/lib/html-proofer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8be1f60d1495959b468c2cfad3a4d659a5817b934bb2011906540d296e2a062
|
4
|
+
data.tar.gz: 39ecb6a6899913c4745289443ff77cf1483d3578689fc616099bb00df90a4f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce1749adb1022b2a3245396c28b990d4de6bfe368fb5944cddf81b48822f54dff8c744b847e65bcd4cb040f2e7f63a1cbdcccebda943380ab767ecbd96161c8a
|
7
|
+
data.tar.gz: 0ffc3e5095dbf40272113991b521a0909408a40715efb2119bfd8f4a310b62b6884fe2566beb198e873f781d6d0ebefed06a966a91a4772309c53835c66ce483
|
data/bin/htmlproofer
CHANGED
@@ -50,7 +50,7 @@ Mercenary.program(:htmlproofer) do |p|
|
|
50
50
|
p.option 'typhoeus_config', '--typhoeus-config CONFIG', String, 'JSON-formatted string of Typhoeus config. Will override the html-proofer defaults.'
|
51
51
|
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
52
|
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
|
-
p.option 'root_dir', '--root-
|
53
|
+
p.option 'root_dir', '--root-dir PATH', String, 'The absolute path to the directory serving your html-files.'
|
54
54
|
|
55
55
|
p.action do |args, opts|
|
56
56
|
args = ['.'] if args.empty?
|
data/lib/html-proofer/element.rb
CHANGED
@@ -169,6 +169,10 @@ module HTMLProofer
|
|
169
169
|
url.start_with?('?')
|
170
170
|
end
|
171
171
|
|
172
|
+
def absolute_path?(path)
|
173
|
+
path.start_with?('/')
|
174
|
+
end
|
175
|
+
|
172
176
|
def file_path
|
173
177
|
return if path.nil? || path.empty?
|
174
178
|
|
@@ -176,22 +180,16 @@ module HTMLProofer
|
|
176
180
|
|
177
181
|
path_dot_ext = path + @check.options[:extension] if @check.options[:assume_extension]
|
178
182
|
|
179
|
-
if
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
base = File.dirname @check.path
|
190
|
-
else # relative link, path is a directory
|
191
|
-
base = @check.path
|
192
|
-
end
|
193
|
-
|
194
|
-
file = File.join base, path
|
183
|
+
base = if absolute_path?(path) # path relative to root
|
184
|
+
@check.options[:root_dir] || File.dirname(@check.src)
|
185
|
+
elsif File.exist?(File.expand_path(path, @check.src)) || File.exist?(File.expand_path(path_dot_ext, @check.src)) # relative links, path is a file
|
186
|
+
File.dirname(@check.path)
|
187
|
+
elsif File.exist?(File.join(File.dirname(@check.path), path)) || File.exist?(File.join(File.dirname(@check.path), path_dot_ext)) # rubocop:disable Lint/DuplicateBranch; relative links in nested dir, path is a file
|
188
|
+
File.dirname(@check.path)
|
189
|
+
else # relative link, path is a directory
|
190
|
+
@check.path
|
191
|
+
end
|
192
|
+
file = File.join(base, path)
|
195
193
|
if @check.options[:assume_extension] && File.file?("#{file}#{@check.options[:extension]}")
|
196
194
|
file = "#{file}#{@check.options[:extension]}"
|
197
195
|
elsif File.directory?(file) && !unslashed_directory?(file) # implicit index support
|
@@ -203,14 +201,15 @@ module HTMLProofer
|
|
203
201
|
|
204
202
|
# checks if a file exists relative to the current pwd
|
205
203
|
def exists?
|
206
|
-
return @checked_paths[absolute_path] if @checked_paths.key?
|
204
|
+
return @checked_paths[absolute_path] if @checked_paths.key?(absolute_path)
|
207
205
|
|
208
|
-
@checked_paths[absolute_path] = File.exist?
|
206
|
+
@checked_paths[absolute_path] = File.exist?(absolute_path)
|
209
207
|
end
|
210
208
|
|
211
209
|
def absolute_path
|
212
210
|
path = file_path || @check.path
|
213
|
-
|
211
|
+
|
212
|
+
File.expand_path(path, Dir.pwd)
|
214
213
|
end
|
215
214
|
|
216
215
|
def ignores_pattern_check(links)
|
data/lib/html-proofer/runner.rb
CHANGED
data/lib/html-proofer/version.rb
CHANGED
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.17.
|
4
|
+
version: 3.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|