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.
Return a XMLElement tree that represents the example file as HTML code.
# File lib/taskjuggler/RichText/FunctionExample.rb, line 34 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
Generated with the Darkfish Rdoc Generator 2.