class RDoc::Markup::ToTableOfContents

def self.to_toc

def self.to_toc
  @to_toc ||= new
end

def accept_document document

def accept_document document
  @omit_headings_below = document.omit_headings_below
  super
end

def accept_heading heading

def accept_heading heading
  @res << heading unless suppressed? heading
end

def end_accepting

def end_accepting
  @res
end

def initialize # :nodoc:

:nodoc:
def initialize # :nodoc:
  super nil
  @omit_headings_below = nil
end

def start_accepting

def start_accepting
  @omit_headings_below = nil
  @res = []
end

def suppressed? heading

def suppressed? heading
  return false unless @omit_headings_below
  heading.level > @omit_headings_below
end