Class TaskJuggler::TableOfContents
In: lib/taskjuggler/RichText/TableOfContents.rb
Parent: Object

This class can be used to store a table of contents. It‘s just an Array of TOCEntry objects. Each TOCEntry objects represents the title of a section.

Methods

addEntry   each   new   to_html  

Public Class methods

Create an empty TableOfContents object.

[Source]

# File lib/taskjuggler/RichText/TableOfContents.rb, line 24
    def initialize
      @entries = []
    end

Public Instance methods

This method must be used to add new TOCEntry objects to the TableOfContents. entry must be a TOCEntry object reference.

[Source]

# File lib/taskjuggler/RichText/TableOfContents.rb, line 30
    def addEntry(entry)
      @entries << entry
    end

[Source]

# File lib/taskjuggler/RichText/TableOfContents.rb, line 34
    def each
      @entries.each { |e| yield e }
    end

Return HTML elements that represent the content of the TableOfContents object. The result is a tree of XMLElement objects.

[Source]

# File lib/taskjuggler/RichText/TableOfContents.rb, line 40
    def to_html
      div = XMLElement.new('div',
                           'style' => 'margin-left:15%; margin-right:15%;')
      div << (table = XMLElement.new('table'))
      @entries.each { |e| table << e.to_html }

      div
    end

[Validate]