# File lib/nanoc/extra/checking/checks/internal_links.rb, line 28 def valid?(href, origin) # Skip hrefs that point to self # FIXME this is ugly and won’t always be correct return true if href == '.' # Remove target path = href.sub(/#.*$/, '') return true if path.empty? # Remove query string path = path.sub(/\?.*$/, '') return true if path.empty? # Make absolute if path[0, 1] == '/' path = @site.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)) } # Nope :( return false end