Class | Hpricot::DocType |
In: |
lib/haml/html.rb
|
Parent: | Object |
@see Haml::HTML::Node#to_haml
# File lib/haml/html.rb, line 140 140: def to_haml(tabs, options) 141: attrs = public_id.nil? ? ["", "", ""] : 142: public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0] 143: if attrs == nil 144: raise Exception.new("Invalid doctype") 145: end 146: 147: type, version, strictness = attrs.map { |a| a.downcase } 148: if type == "html" 149: version = "" 150: strictness = "strict" if strictness == "" 151: end 152: 153: if version == "1.0" || version.empty? 154: version = nil 155: end 156: 157: if strictness == 'transitional' || strictness.empty? 158: strictness = nil 159: end 160: 161: version = " #{version.capitalize}" if version 162: strictness = " #{strictness.capitalize}" if strictness 163: 164: "#{tabulate(tabs)}!!!#{version}#{strictness}\n" 165: end