Class: Nokogiri::XML::DTD
- Inherits:
-
Object
- Object
- Nokogiri::XML::DTD
- Defined in:
- lib/html2slim/nokogiri_monkeypatches.rb
Instance Method Summary collapse
Instance Method Details
#to_slim(_lvl = 0) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/html2slim/nokogiri_monkeypatches.rb', line 25 def to_slim(_lvl = 0) if to_xml.include?('xml') to_xml.include?('iso-8859-1') ? 'doctype xml ISO-88591' : 'doctype xml' elsif to_xml.include?('XHTML') || to_xml.include?('HTML 4.01') available_versions = Regexp.union ['Basic', '1.1', 'strict', 'Frameset', 'Mobile', 'Transitional'] version = to_xml.match(available_versions).to_s.downcase "doctype #{version}" else 'doctype html' end end |