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



1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
# File 'lib/mmmd/blankshell.rb', line 1772

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