Module: Bridgetown::Builders::DSL::Inspectors::HTML
- Defined in:
- bridgetown-builder/lib/bridgetown-builder/dsl/inspectors.rb
Overview
HTML inspector type
Class Method Summary collapse
-
.call(resource, inspectors) ⇒ String
Process the resource with the available inspectors and return the output HTML.
-
.can_run?(resource, inspectors) ⇒ Boolean
Are there inspectors available? Is it an .htm* file?.
Class Method Details
.call(resource, inspectors) ⇒ String
Process the resource with the available inspectors and return the output HTML
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'bridgetown-builder/lib/bridgetown-builder/dsl/inspectors.rb', line 30 def self.call(resource, inspectors) doc = if resource.site.config.html_inspector_parser == "nokolexbor" Nokolexbor::HTML(resource.output) else Nokogiri.HTML5(resource.output) end inspectors.each do |block| block.call(doc, resource) end doc.to_html end |
.can_run?(resource, inspectors) ⇒ Boolean
Are there inspectors available? Is it an .htm* file?
21 22 23 24 25 |
# File 'bridgetown-builder/lib/bridgetown-builder/dsl/inspectors.rb', line 21 def self.can_run?(resource, inspectors) inspectors && resource.output_ext&.starts_with?(".htm") && !resource.data.bypass_inspectors end |