Class | Hpricot::DocType |
In: |
lib/haml/html.rb
|
Parent: | Object |
@see Haml::HTML::Node#to_haml
# File lib/haml/html.rb, line 184 184: def to_haml(tabs, options) 185: attrs = public_id.nil? ? ["", "", ""] : 186: public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0] 187: raise Haml::SyntaxError.new("Invalid doctype") if attrs == nil 188: 189: type, version, strictness = attrs.map { |a| a.downcase } 190: if type == "html" 191: version = "" 192: strictness = "strict" if strictness == "" 193: end 194: 195: if version == "1.0" || version.empty? 196: version = nil 197: end 198: 199: if strictness == 'transitional' || strictness.empty? 200: strictness = nil 201: end 202: 203: version = " #{version.capitalize}" if version 204: strictness = " #{strictness.capitalize}" if strictness 205: 206: "#{tabulate(tabs)}!!!#{version}#{strictness}\n" 207: end