Class: Nanoc::Checking::Checks::InternalLinks Private
- Inherits:
-
Nanoc::Checking::Check
- Object
- Nanoc::Core::Context
- Nanoc::Checking::Check
- Nanoc::Checking::Checks::InternalLinks
- Defined in:
- lib/nanoc/checking/checks/internal_links.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A check that verifies that all internal links point to a location that exists.
Instance Attribute Summary
Attributes inherited from Nanoc::Checking::Check
Instance Method Summary collapse
-
#run ⇒ void
private
Starts the validator.
Methods inherited from Nanoc::Checking::Check
#add_issue, create, define, #excluded_patterns, #initialize, #output_filenames, #output_html_filenames
Constructor Details
This class inherits a constructor from Nanoc::Checking::Check
Instance Method Details
#run ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Starts the validator. The results will be printed to stdout.
Internal links that match a regexp pattern in ‘@config[:internal_links]` will be skipped.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/nanoc/checking/checks/internal_links.rb', line 18 def run # TODO: de-duplicate this (duplicated in external links check) filenames = output_html_filenames uris = ::Nanoc::Checking::LinkCollector.new(filenames, :internal).filenames_per_href uris.each_pair do |href, fns| fns.each do |filename| next if valid?(href, filename) add_issue( "broken reference to <#{href}>", subject: filename, ) end end end |