class TaskJuggler::UserManual
This class specializes the RichTextDocument
class for the TaskJuggler
user manual. This manual is not only generated from a set of RichTextSnip
files, but also contains the SyntaxReference
for the TJP syntax.
Public Class Methods
Create a UserManual
object and gather the TJP syntax information.
TaskJuggler::RichTextDocument::new
# File lib/taskjuggler/UserManual.rb, line 32 def initialize super # Don't confuse this with RichTextDocument#references @reference = SyntaxReference.new(self) registerFunctionHandler(RichTextFunctionExample.new) @linkTarget = '_top' end
Public Instance Methods
# File lib/taskjuggler/UserManual.rb, line 40 def generate(directory) # Directory where to find the manual RichText sources. Must be relative # to lib directory. srcDir = AppConfig.dataDirs('manual')[0] # Directory where to put the generated HTML files. Must be relative to # lib directory. destDir = directory + (directory[-1] == '/' ? '' : '/') # A list of all source files. The order is important. %w( Intro TaskJuggler_2x_Migration Reporting_Bugs Installation How_To_Contribute Getting_Started Tutorial The_TaskJuggler_Syntax Rich_Text_Attributes List_Attributes Software Day_To_Day_Juggling TaskJuggler_Internals fdl ).each do |file| snip = addSnip(File.join(srcDir, file)) snip.cssClass = 'manual' end # Generate the table of contents tableOfContents # Generate the HTML files. generateHTML(destDir) checkInternalReferences FileUtils.cp_r(AppConfig.dataDirs('data/css')[0], destDir) end
Generate the manual in HTML format. directory specifies a directory where the HTML files should be put.
TaskJuggler::RichTextDocument#generateHTML
# File lib/taskjuggler/UserManual.rb, line 77 def generateHTML(directory) generateHTMLindex(directory) generateHTMLReference(directory) # The SyntaxReference only generates the reference list when the HTML is # generated. So we have to collect it after the HTML generation. @references.merge!(@reference.internalReferences) super end
Callback function used by the RichTextDocument
class to generate the cover page for the manual.
# File lib/taskjuggler/UserManual.rb, line 96 def generateHTMLCover [ DIV.new('align' => 'center', 'style' => 'margin-top:40px; margin-botton:40px') do [ H1.new { "The #{AppConfig.softwareName} User Manual" }, EM.new { 'Project Management beyond Gantt Chart drawing' }, BR.new, B.new do "Copyright (c) #{AppConfig.copyright.join(', ')} " + "by #{AppConfig.authors.join(', ')}" end, BR.new, "Generated on #{TjTime.new.strftime('%Y-%m-%d')}", BR.new, H3.new { "This manual covers #{AppConfig.softwareName} " + "version #{AppConfig.version}." } ] end, BR.new, HR.new, BR.new ] end
Callback function used by the RichTextDocument
class to generate the header for the manual pages.
# File lib/taskjuggler/UserManual.rb, line 123 def generateHTMLHeader DIV.new('align' => 'center') do [ H3.new('align' => 'center') do "The #{AppConfig.softwareName} User Manual" end, EM.new('align' => 'center') do 'Project Management beyond Gantt Chart Drawing' end ] end end
Generate the top-level file for the HTML user manual.
# File lib/taskjuggler/UserManual.rb, line 194 def generateHTMLindex(directory) html = HTMLDocument.new(:frameset) html.generateHead("The #{AppConfig.softwareName} User Manual", { 'description' => 'A reference and user manual for the ' + 'TaskJuggler project management software.', 'keywords' => 'taskjuggler, manual, reference'}) html.html << FRAMESET.new('cols' => '15%, 85%') do [ FRAMESET.new('rows' => '140,*') do [ FRAME.new('src' => 'alphabet.html', 'name' => 'alphabet'), FRAME.new('src' => 'navbar.html', 'name' => 'navigator') ] end, FRAME.new('src' => 'toc.html', 'name' => 'display') ] end html.write(directory + 'index.html') end
Callback function used by the RichTextDocument
and KeywordDocumentation
classes to generate the HTML style sheet for the manual pages.
# File lib/taskjuggler/UserManual.rb, line 89 def generateStyleSheet XMLElement.new('link', 'rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'css/tjmanual.css') end