Class: HTML5::TreeBuilders::Hpricot::TreeBuilder

Inherits:
Base::TreeBuilder show all
Defined in:
lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb

Instance Attribute Summary

Attributes inherited from Base::TreeBuilder

#activeFormattingElements, #document, #formPointer, #head_pointer, #open_elements

Instance Method Summary collapse

Methods inherited from Base::TreeBuilder

#clearActiveFormattingElements, #createElement, #elementInActiveFormattingElements, #elementInScope, #generateImpliedEndTags, #getTableMisnestedNodePosition, #insertText, #insert_comment, #insert_element, #insert_elementNormal, #insert_elementTable, #insert_from_table=, #reconstructActiveFormattingElements, #reset

Constructor Details

#initializeTreeBuilder

Returns a new instance of TreeBuilder.



202
203
204
205
206
207
208
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb', line 202

def initialize
  @documentClass = Document
  @doctypeClass  = DocumentType
  @elementClass  = Element
  @commentClass  = CommentNode
  @fragmentClass = DocumentFragment
end

Instance Method Details

#get_documentObject



219
220
221
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb', line 219

def get_document
  @document.hpricot
end

#get_fragmentObject



223
224
225
226
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb', line 223

def get_fragment
  @document = super
  return @document.hpricot.children
end

#insertDoctype(name, public_id, system_id) ⇒ Object



210
211
212
213
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb', line 210

def insertDoctype(name, public_id, system_id)
  doctype = @doctypeClass.new(name, public_id, system_id)
  @document.appendChild(doctype)
end

#testSerializer(node) ⇒ Object



215
216
217
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb', line 215

def testSerializer(node)
  node.printTree
end