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