Class: PointBlank::DOM::Document

Inherits:
Block show all
Defined in:
lib/mmmd/blankshell.rb

Overview

Document root

Instance Attribute Summary

Attributes inherited from DOMObject

#content, #parent, #parser, #position, #properties, #temp_children

Class Method Summary collapse

Methods inherited from DOMObject

#[], #[]=, #append_child, #append_temp_child, #children, define_child, define_overlay, define_parser, define_scanner, #each, inherited, #initialize, #root, sort_children, sort_overlays, upsource, valid_children, valid_overlays

Constructor Details

This class inherits a constructor from PointBlank::DOM::DOMObject

Class Method Details

.parse(doc) ⇒ Object



1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
# File 'lib/mmmd/blankshell.rb', line 1735

def self.parse(doc)
  output = super(doc)
  # This has to be done after the document gets processed due to the way link
  # definitions have to be handled.
  parse_inner = lambda do |block|
    child = ::PointBlank::DOM::InlineRoot.new
    child.parent = block.parent
    child.content = block.content
    scanner = ::PointBlank::Parsing::StackScanner.new(child)
    scanner.scan
    block.content = ""
    child.each { |c| block.append_child(c) }
  end
  output.temp_children.each { |block| parse_inner.call(block) }
  output.temp_children.clear
  output
end