Class: Nanoc::Extra::Checking::Checks::MixedContent
- Inherits:
-
Nanoc::Extra::Checking::Check
- Object
- Nanoc::Extra::Checking::Check
- Nanoc::Extra::Checking::Checks::MixedContent
- Defined in:
- lib/nanoc/extra/checking/checks/mixed_content.rb
Overview
A check that verifies HTML files do not reference external resources with URLs that would trigger “mixed content” warnings.
Constant Summary
- PROTOCOL_PATTERN =
/^(\w+):\/\//
Instance Attribute Summary
Attributes inherited from Nanoc::Extra::Checking::Check
Instance Method Summary (collapse)
Methods inherited from Nanoc::Extra::Checking::Check
#add_issue, #initialize, #output_filenames
Methods included from PluginRegistry::PluginMethods
#all, #identifier, #identifiers, #named, #register
Constructor Details
This class inherits a constructor from Nanoc::Extra::Checking::Check
Instance Method Details
- (Object) run
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nanoc/extra/checking/checks/mixed_content.rb', line 9 def run filenames = output_filenames.select { |f| File.extname(f) == '.html' } resource_uris_with_filenames = ::Nanoc::Extra::LinkCollector.new(filenames).filenames_per_resource_uri resource_uris_with_filenames.each_pair do |uri, fns| next unless guaranteed_insecure?(uri) fns.each do |filename| add_issue( "mixed content include: #{uri}", subject: filename) end end end |