lib/nanoc/extra/checking/checks/internal_links.rb in nanoc-3.7.3 vs lib/nanoc/extra/checking/checks/internal_links.rb in nanoc-3.7.4
- old
+ new
@@ -17,19 +17,19 @@
# TODO de-duplicate this (duplicated in external links check)
filenames = output_filenames.select { |f| File.extname(f) == '.html' }
hrefs_with_filenames = ::Nanoc::Extra::LinkCollector.new(filenames, :internal).filenames_per_href
hrefs_with_filenames.each_pair do |href, fns|
fns.each do |filename|
- unless valid?(href, filename)
+ next if valid?(href, filename)
+
add_issue(
"broken reference to #{href}",
:subject => filename)
- end
end
end
end
- protected
+ protected
def valid?(href, origin)
# Skip hrefs that point to self
# FIXME this is ugly and won’t always be correct
return true if href == '.'