class RDoc::Markup::Heading

A heading with a level (1-6) and text

Public Class Methods

to_html() click to toggle source

A singleton plain HTML formatter for headings. Used for creating labels for the Table of Contents

# File lib/rdoc/markup/heading.rb, line 20
def self.to_html
  return @to_html if @to_html

  markup = RDoc::Markup.new
  markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF

  @to_html = RDoc::Markup::ToHtml.new nil

  def @to_html.handle_special_CROSSREF special
    special.text.sub(/^\/, '')
  end

  @to_html
end
to_label() click to toggle source

A singleton RDoc::Markup::ToLabel formatter for headings.

# File lib/rdoc/markup/heading.rb, line 12
def self.to_label
  @to_label ||= RDoc::Markup::ToLabel.new
end

Public Instance Methods

accept(visitor) click to toggle source

Calls accept_heading on visitor

# File lib/rdoc/markup/heading.rb, line 38
def accept visitor
  visitor.accept_heading self
end
aref() click to toggle source

An HTML-safe anchor reference for this header.

# File lib/rdoc/markup/heading.rb, line 45
def aref
  "label-#{self.class.to_label.convert text.dup}"
end
plain_html() click to toggle source

HTML markup of the text of this label without the surrounding header element.

# File lib/rdoc/markup/heading.rb, line 53
def plain_html
  self.class.to_html.to_html(text.dup)
end