class TaskJuggler::RichTextFunctionExample

This class is a specialized RichTextFunctionHandler that turns references to TJP example code in the test/TestSuite/Syntax/Correct directory into embedded example code. It currently only supports HTML.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/taskjuggler/RichText/FunctionExample.rb, line 24
def initialize
  super('example')
  @blockFunction = true
end

Public Instance Methods

to_html(args) click to toggle source

Return a XMLElement tree that represents the example file as HTML code.

# File lib/taskjuggler/RichText/FunctionExample.rb, line 35
def to_html(args)
  unless (file = args['file'])
    raise "'file' argument missing"
  end
  tag = args['tag']

  example = TjpExample.new
  fileName = File.join(AppConfig.dataDirs('test')[0], 'TestSuite',
                       'Syntax', 'Correct', "#{file}.tjp")
  example.open(fileName)
  frame = XMLElement.new('div', 'class' => 'codeframe')
  frame << (pre = XMLElement.new('pre', 'class' => 'code'))
  unless (text = example.to_s(tag))
    raise "There is no tag '#{tag}' in file " +
        "#{fileName}."
  end
  pre << XMLText.new(text)
  frame
end
to_s(args) click to toggle source

Not supported for this function

# File lib/taskjuggler/RichText/FunctionExample.rb, line 30
def to_s(args)
  ''
end
to_tagged(args) click to toggle source

Not supported for this function.

# File lib/taskjuggler/RichText/FunctionExample.rb, line 56
def to_tagged(args)
  nil
end