Module: JekyllAutoThumbnails::HtmlParser
- Defined in:
- lib/jekyll-auto-thumbnails/html_parser.rb
Overview
Dispatch between Nokogiri’s HTML5 and libxml2-based HTML4 parsers.
HTML5 is the default throughout the gem; HTML4 is kept as an opt-in for users who depended on libxml2’s serialization quirks (notably the injected ‘<meta http-equiv=“Content-Type”>`).
Class Method Summary collapse
-
.parse(html, parser) ⇒ Nokogiri::HTML5::Document, Nokogiri::HTML4::Document
Parse an HTML string with the selected parser.
Class Method Details
.parse(html, parser) ⇒ Nokogiri::HTML5::Document, Nokogiri::HTML4::Document
Parse an HTML string with the selected parser.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/jekyll-auto-thumbnails/html_parser.rb', line 28 def parse(html, parser) case parser when :html5 Nokogiri::HTML5.parse(html) when :html4 Nokogiri::HTML(html) else raise ArgumentError, "Unknown HTML parser: #{parser.inspect}" end end |