Class: Hpricot::DocType

Inherits:
BaseEle show all
Includes:
Trav, Leaf
Defined in:
lib/hpricot/tag.rb,
lib/hpricot/modules.rb,
lib/hpricot/modules.rb

Defined Under Namespace

Modules: Trav

Constant Summary

Constants included from Hpricot

AttrCore, AttrEvents, AttrFocus, AttrHAlign, AttrI18n, AttrVAlign, Attrs, ElementContent, ElementExclusions, ElementInclusions, FORM_TAGS, NamedCharacters, NamedCharactersPattern, OmittedAttrName, PREDEFINED, PREDEFINED_U, SELF_CLOSING_TAGS

Instance Attribute Summary

Attributes inherited from BaseEle

#parent, #raw_string

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Leaf::Trav

#traverse_all_element, #traverse_some_element, #traverse_text_internal

Methods included from Traverse

#after, #at, #before, #bogusetag?, #children_of_type, #clean_path, #comment?, #css_path, #doc?, #doctype?, #elem?, filter, #following, #get_subnode, #html, #index, #inner_html=, #inner_text, #make, #next, #node_position, #nodes_at, #position, #preceding, #previous, #procins?, #search, #swap, #text?, #to_html, #to_original_html, #to_plain_text, #traverse_element, #traverse_text, #xmldecl?, #xpath

Methods included from Leaf

#pretty_print

Methods included from Hpricot

XML, build, build_node, make, scan, uxs, xchr, xs

Methods inherited from BaseEle

alterable, #altered!, #html_quote, #if_output

Constructor Details

#initialize(target, pubid, sysid) ⇒ DocType

Returns a new instance of DocType.



186
187
188
# File 'lib/hpricot/tag.rb', line 186

def initialize(target, pubid, sysid)
  @target, @public_id, @system_id = target, pubid, sysid
end

Class Method Details

.parse(root_element_name, attrs, raw_string) ⇒ Object



267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/hpricot/parse.rb', line 267

def DocType.parse(root_element_name, attrs, raw_string)
  if attrs
    public_identifier = attrs['public_id']
    system_identifier = attrs['system_id']
  end

  root_element_name = root_element_name.downcase

  result = DocType.new(root_element_name, public_identifier, system_identifier)
  result.raw_string = raw_string
  result
end

Instance Method Details

#output(out, opts = {}) ⇒ Object



191
192
193
194
195
196
197
198
# File 'lib/hpricot/tag.rb', line 191

def output(out, opts = {})
  out <<
    if_output(opts) do
      "<!DOCTYPE #{@target} " +
        (@public_id ? "PUBLIC \"#{@public_id}\"" : "SYSTEM") +
        (@system_id ? " #{html_quote(@system_id)}" : "") + ">"
    end
end

#pathnameObject



190
# File 'lib/hpricot/tag.rb', line 190

def pathname; "doctype()" end