Class: Prosereflect::Input::Html

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

Defined Under Namespace

Classes: ValidationError

Class Method Summary collapse

Class Method Details

.parse(html) ⇒ Object

Parse HTML content and return a Prosereflect::Document



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/prosereflect/input/html.rb', line 10

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