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.
# File lib/taskjuggler/RichText/FunctionExample.rb, line 24 def initialize super('example') @blockFunction = true end
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 = 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
Not supported for this function
# File lib/taskjuggler/RichText/FunctionExample.rb, line 30 def to_s(args) '' end
Not supported for this function.
# File lib/taskjuggler/RichText/FunctionExample.rb, line 56 def to_tagged(args) nil end