Class Hpricot::DocType
In: lib/haml/html.rb
Parent: Object

@see Hpricot

Methods

to_haml  

Public Instance methods

@see Haml::HTML::Node#to_haml

[Source]

     # File lib/haml/html.rb, line 129
129:       def to_haml(tabs, options)
130:         attrs = public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0]
131:         if attrs == nil
132:           raise Exception.new("Invalid doctype")
133:         end
134: 
135:         type, version, strictness = attrs.map { |a| a.downcase }
136:         if type == "html"
137:           version = "1.0"
138:           strictness = "transitional"
139:         end
140: 
141:         if version == "1.0" || version.empty?
142:           version = nil
143:         end
144: 
145:         if strictness == 'transitional' || strictness.empty?
146:           strictness = nil
147:         end
148: 
149:         version = " #{version}" if version
150:         if strictness
151:           strictness[0] = strictness[0] - 32
152:           strictness = " #{strictness}"
153:         end
154: 
155:         "#{tabulate(tabs)}!!!#{version}#{strictness}\n"
156:       end

[Validate]