Class: Garterbelt::Doctype

Inherits:
ClosedTag show all
Defined in:
lib/renderers/doctype.rb

Constant Summary collapse

ATTRIBUTES =
{
  :transitional => "html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"",
  :strict => 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"',
  :frameset => 'html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"',
  :html5 => 'html',
  :html1_1 => 'html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"',
  :basic => 'html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"',
  :mobile => 'html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd"',
  :rdfa => 'html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"'
}

Instance Attribute Summary

Attributes inherited from ClosedTag

#attributes, #css_class, #type

Attributes inherited from Renderer

#escape, #style, #view

Instance Method Summary collapse

Methods inherited from ClosedTag

#c, #id, #initialize, #render

Methods inherited from Renderer

#indent, #initialize, #level, #line_end, #output, #output=, #render

Constructor Details

This class inherits a constructor from Garterbelt::ClosedTag

Instance Method Details

#rendered_attributesObject



14
15
16
# File 'lib/renderers/doctype.rb', line 14

def rendered_attributes
  ATTRIBUTES[type] || ATTRIBUTES[:transitional]
end

#templateObject



18
19
20
# File 'lib/renderers/doctype.rb', line 18

def template
  "#{indent}<!DOCTYPE #{rendered_attributes}>\n"
end