Parent

Methods

Hpricot::DocType

@see Hpricot @private

Public Instance Methods

to_haml(tabs, options) click to toggle source

@see Haml::HTML::Node#to_haml

# File lib/html2haml/html.rb, line 182
def to_haml(tabs, options)
  attrs = public_id.nil? ? ["", "", ""] :
    public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0]
  raise Haml::SyntaxError.new("Invalid doctype") if attrs == nil

  type, version, strictness = attrs.map { |a| a.downcase }
  if type == "html"
    version = ""
    strictness = "strict" if strictness == ""
  end

  if version == "1.0" || version.empty?
    version = nil
  end

  if strictness == 'transitional' || strictness.empty?
    strictness = nil
  end

  version = " #{version.capitalize}" if version
  strictness = " #{strictness.capitalize}" if strictness

  "#{tabulate(tabs)}!!!#{version}#{strictness}\n"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.