Class: Canon::Formatters::HtmlFormatter
- Inherits:
-
HtmlFormatterBase
- Object
- HtmlFormatterBase
- Canon::Formatters::HtmlFormatter
- Defined in:
- lib/canon/formatters/html_formatter.rb
Overview
HTML formatter for HTML 4/5 and XHTML
Constant Summary
Constants inherited from HtmlFormatterBase
Canon::Formatters::HtmlFormatterBase::BLOCK_ELEMENTS, Canon::Formatters::HtmlFormatterBase::WHITESPACE_SENSITIVE_ELEMENTS
Class Method Summary collapse
-
.parse(html) ⇒ Nokogiri::HTML::Document, Nokogiri::XML::Document
Parse HTML into a Nokogiri document.
Methods inherited from HtmlFormatterBase
Class Method Details
.parse(html) ⇒ Nokogiri::HTML::Document, Nokogiri::XML::Document
Parse HTML into a Nokogiri document
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/canon/formatters/html_formatter.rb', line 16 def self.parse(html) # Validate before parsing Canon::Validators::HtmlValidator.validate!(html) if xhtml?(html) Nokogiri::XML(html) else Nokogiri::HTML5(html) end end |