| Class | Hpricot::DocType |
| In: |
lib/haml/html.rb
|
| Parent: | Object |
@see Haml::HTML::Node#to_haml
# File lib/haml/html.rb, line 201
201: def to_haml(tabs, options)
202: attrs = public_id.nil? ? ["", "", ""] :
203: public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0]
204: raise Haml::SyntaxError.new("Invalid doctype") if attrs == nil
205:
206: type, version, strictness = attrs.map { |a| a.downcase }
207: if type == "html"
208: version = ""
209: strictness = "strict" if strictness == ""
210: end
211:
212: if version == "1.0" || version.empty?
213: version = nil
214: end
215:
216: if strictness == 'transitional' || strictness.empty?
217: strictness = nil
218: end
219:
220: version = " #{version.capitalize}" if version
221: strictness = " #{strictness.capitalize}" if strictness
222:
223: "#{tabulate(tabs)}!!!#{version}#{strictness}\n"
224: end