Class: Prosereflect::Input::Html

Inherits:
Object
  • Object
show all
Defined in:
lib/prosereflect/input/html.rb

Class Method Summary collapse

Class Method Details

.parse(html) ⇒ Object

Parse HTML content and return a Prosereflect::Document



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/prosereflect/input/html.rb', line 37

def parse(html)
  html_doc = Nokogiri::HTML(html)
  document = Document.create # Use create instead of new to initialize content array

  content_node = html_doc.at_css('body') || html_doc.root

  # Process all child nodes
  process_node_children(content_node, document)

  document
end