lib/nanoc/extra/checking/checks/internal_links.rb in nanoc-4.0.0b2 vs lib/nanoc/extra/checking/checks/internal_links.rb in nanoc-4.0.0b3
- old
+ new
@@ -1,7 +1,5 @@
-# encoding: utf-8
-
require 'uri'
module Nanoc::Extra::Checking::Checks
# A check that verifies that all internal links point to a location that exists.
#
@@ -49,26 +47,26 @@
# Decode URL (e.g. '%20' -> ' ')
path = URI.unescape(path)
# Make absolute
if path[0, 1] == '/'
- path = @site.config[:output_dir] + path
+ path = @config[:output_dir] + path
else
path = ::File.expand_path(path, ::File.dirname(origin))
end
# Check whether file exists
return true if File.file?(path)
# Check whether directory with index file exists
- return true if File.directory?(path) && @site.config[:index_filenames].any? { |fn| File.file?(File.join(path, fn)) }
+ return true if File.directory?(path) && @config[:index_filenames].any? { |fn| File.file?(File.join(path, fn)) }
# Nope :(
false
end
def excluded?(href)
- excludes = @site.config.fetch(:checks, {}).fetch(:internal_links, {}).fetch(:exclude, [])
+ excludes = @config.fetch(:checks, {}).fetch(:internal_links, {}).fetch(:exclude, [])
excludes.any? { |pattern| Regexp.new(pattern).match(href) }
end
end
end