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

The RichTextIntermediate is a container for the intermediate representation of a RichText object. By calling the to_* members it can be converted into the respective formats. A RichTextIntermediate object is generated by RichText::generateIntermediateFormat.

Methods

Attributes

blockMode  [RW] 
cssClass  [RW] 
functionHandlers  [R] 
indent  [RW] 
lineWidth  [RW] 
linkTarget  [RW] 
listIndent  [RW] 
parIndent  [RW] 
preIndent  [RW] 
richText  [R] 
sectionNumbers  [RW] 
titleIndent  [RW] 
tree  [RW] 

Public Class methods

[Source]

# File lib/taskjuggler/RichText.rb, line 148
    def initialize(richText)
      # A reference to the corresponding RichText object the RTI is derived
      # from.
      @richText = richText
      # The root of the generated intermediate format. This is a
      # RichTextElement.
      @tree = nil
      # The blockMode specifies whether the RichText should be interpreted as
      # a line of text or a block (default).
      @blockMode = true
      # Set this to false to disable automatically generated section numbers.
      @sectionNumbers = true
      # Set this to the maximum width used for text output.
      @lineWidth = 80
      # The indentation used for all text output.
      @indent = 0
      # Additional indentation used for titles in text output.
      @titleIndent = 0
      # Additional indentation used for paragraph text output.
      @parIndent = 0
      # Additional indentation used for lists in text output.
      @listIndent = 1
      # Additional indentation used for <pre> sections in text output.
      @preIndent = 0
      # The target used for hypertext links.
      @linkTarget = nil
      # The CSS class used for some key HTML elements.
      @cssClass = nil
      # These are the RichTextFunctionHandler objects to handle references with
      # a function specification.
      @functionHandlers = {}
    end

Public Instance methods

Return true if the RichText has no content.

[Source]

# File lib/taskjuggler/RichText.rb, line 195
    def empty?
      @tree.empty?
    end

Return the handler for the given function or raise an exception if it does not exist.

[Source]

# File lib/taskjuggler/RichText.rb, line 190
    def functionHandler(function)
      @functionHandlers[function]
    end

Return an Array with all other snippet names that are referenced by internal references in this RichTextElement.

[Source]

# File lib/taskjuggler/RichText.rb, line 209
    def internalReferences
      @tree.internalReferences
    end

Use this function to register new RichTextFunctionHandler objects with this class.

[Source]

# File lib/taskjuggler/RichText.rb, line 183
    def registerFunctionHandler(functionHandler)
      raise "Bad function handler" unless functionHandler
      @functionHandlers[functionHandler.function] = functionHandler.dup
    end

[Source]

# File lib/taskjuggler/RichText/RTFWithQuerySupport.rb, line 36
    def setQuery(query)
      @functionHandlers.each_value do |handler|
        if handler.respond_to?('setQuery')
          handler.setQuery(query)
        end
      end
    end

Recursively extract the section headings from the RichTextElement and build the TableOfContents toc with the gathered sections. fileName is the base name (without .html or other suffix) of the file the TOCEntries should point to.

[Source]

# File lib/taskjuggler/RichText.rb, line 203
    def tableOfContents(toc, fileName)
      @tree.tableOfContents(toc, fileName)
    end

Convert the intermediate format into a XMLElement objects tree.

[Source]

# File lib/taskjuggler/RichText.rb, line 221
    def to_html
      html = @tree.to_html
      html.chomp! while html[-1] == ?\n
      html
    end

Convert the intermediate format into a plain text String object.

[Source]

# File lib/taskjuggler/RichText.rb, line 214
    def to_s
      str = @tree.to_s
      str.chomp! while str[-1] == ?\n
      str
    end

Convert the intermediate format into a tagged syntax String object.

[Source]

# File lib/taskjuggler/RichText.rb, line 228
    def to_tagged
      @tree.to_tagged
    end

[Validate]