Class: Hpricot::DocType

Inherits:
Object
  • Object
show all
Defined in:
lib/eex2slime/hpricot_monkeypatches.rb

Instance Method Summary collapse

Instance Method Details

#to_slime(lvl = 0) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/eex2slime/hpricot_monkeypatches.rb', line 51

def to_slime(lvl=0)
  if to_s.include? "xml"
    to_s.include?("iso-8859-1") ? "doctype xml ISO-88591" : "doctype xml"
  elsif to_s.include? "XHTML" or self.to_s.include? "HTML 4.01"
    available_versions = Regexp.union ["Basic", "1.1", "strict", "Frameset", "Mobile", "Transitional"]
    version = to_s.match(available_versions).to_s.downcase
    "doctype #{version}"
  else
    "doctype html"
  end
end