Class | Hpricot::DocType |
In: |
lib/haml/html.rb
|
Parent: | Object |
@see Hpricot::Node
@see Hpricot::Node#to_haml
# File lib/haml/html.rb, line 110 110: def to_haml(tabs, options) 111: attrs = public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0] 112: if attrs == nil 113: raise Exception.new("Invalid doctype") 114: end 115: 116: type, version, strictness = attrs.map { |a| a.downcase } 117: if type == "html" 118: version = "1.0" 119: strictness = "transitional" 120: end 121: 122: if version == "1.0" || version.empty? 123: version = nil 124: end 125: 126: if strictness == 'transitional' || strictness.empty? 127: strictness = nil 128: end 129: 130: version = " #{version}" if version 131: if strictness 132: strictness[0] = strictness[0] - 32 133: strictness = " #{strictness}" 134: end 135: 136: "#{tabulate(tabs)}!!!#{version}#{strictness}\n" 137: end