lib/UserManual.rb in taskjuggler-0.0.3 vs lib/UserManual.rb in taskjuggler-0.0.4

- old
+ new

@@ -1,22 +1,23 @@ #!/usr/bin/env ruby -w # encoding: UTF-8 # # = UserManual.rb -- The TaskJuggler III Project Management Software # -# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org> +# Copyright (c) 2006, 2007, 2008, 2009, 2010 by Chris Schlaeger <cs@kde.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # +require 'fileutils' require 'Tj3Config' require 'RichTextDocument' require 'SyntaxReference' require 'TjTime' -require 'RichTextProtocolExample' +require 'RichTextFunctionExample' class TaskJuggler # This class specializes the RichTextDocument class for the TaskJuggler user # manual. This manual is not only generated from a set of RichTextSnip files, @@ -26,11 +27,12 @@ # Create a UserManual object and gather the TJP syntax information. def initialize super # Don't confuse this with RichTextDocument#references @reference = SyntaxReference.new(self) - registerProtocolHandler(RichTextProtocolExample.new) + registerFunctionHandler(RichTextFunctionExample.new) + @linkTarget = '_top' end def generate(directory) # Directory where to find the manual RichText sources. Must be relative # to lib directory. @@ -39,27 +41,29 @@ # directory. destDir = directory + (directory[-1] == '/' ? '' : '/') # A list of all source files. The order is important. %w( Intro - TaskJuggler_2x_Migration - How_To_Contribute - Reporting_Bugs - Installation + TaskJuggler_2x_Migration + Reporting_Bugs + Installation + How_To_Contribute Getting_Started - Rich_Text_Attributes Tutorial + The_TaskJuggler_Syntax + Rich_Text_Attributes Day_To_Day_Juggling fdl ).each do |file| addSnip(srcDir + file) end # Generate the table of contense 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. def generateHTML(directory) @@ -73,88 +77,32 @@ end # Callback function used by the RichTextDocument and KeywordDocumentation # classes to generate the HTML style sheet for the manual pages. def generateStyleSheet - html = [] - html << (style = XMLElement.new('style', 'type' => 'text/css')) - style << XMLBlob.new(<<'EOT' -pre { - font-size:16px; - font-family: Courier; - padding-left:8px; - padding-right:8px; - padding-top:0px; - padding-bottom:0px; -} -p { - margin-top:8px; - margin-bottom:8px; -} -code { - font-size:16px; - font-family: Courier; -} -.table { - background-color:#ABABAB; - width:100%; -} -.tag { - background-color:#E0E0F0; - font-size:16px; - font-weight:bold; - padding-left:8px; - padding-right:8px; - padding-top:5px; - padding-bottom:5px; -} -.descr { - background-color:#F0F0F0; - font-size:16px; - padding-left:8px; - padding-right:8px; - padding-top:5px; - padding-bottom:5px; -} -.codeframe{ - border-width:2px; - border-color:#ABABAB; - border-style:solid; - background-color:#F0F0F0; - margin-top:8px; - margin-bottom:8px; -} -.code { - padding-left:15px; - padding-right:15px; - padding-top:0px; - padding-bottom:0px; -} -EOT - ) - - html + XMLElement.new('link', 'rel' => 'stylesheet', 'type' => 'text/css', + 'href' => 'css/tjmanual.css') end # Callback function used by the RichTextDocument class to generate the cover # page for the manual. def generateHTMLCover html = [] html << (div = XMLElement.new('div', 'align' => 'center', 'style' => 'margin-top:40px; margin-botton:40px')) - div << XMLNamedText.new("The #{AppConfig.packageName} User Manual", + div << XMLNamedText.new("The #{AppConfig.softwareName} User Manual", 'h1') div << XMLNamedText.new('Project Management beyond Gantt Chart drawing', 'em') div << XMLElement.new('br') div << XMLNamedText.new( "Copyright (c) #{AppConfig.copyright.join(', ')} " + "by #{AppConfig.authors.join(', ')}", 'b') div << XMLElement.new('br') div << XMLText.new("Generated on #{TjTime.now.strftime('%Y-%m-%d')}") div << XMLElement.new('br') - div << XMLNamedText.new("This manual covers #{AppConfig.packageName} " + + div << XMLNamedText.new("This manual covers #{AppConfig.softwareName} " + "version #{AppConfig.version}.", 'h3') html << XMLElement.new('br') html << XMLElement.new('hr') html << XMLElement.new('br') @@ -165,11 +113,11 @@ # header for the manual pages. def generateHTMLHeader html = [] html << (headline = XMLElement.new('div', 'align' => 'center')) headline << XMLNamedText.new( - "The #{AppConfig.packageName} User Manual", 'h3', + "The #{AppConfig.softwareName} User Manual", 'h3', 'align' => 'center') headline << XMLNamedText.new( 'Project Management beyond Gantt Chart Drawing', 'em', 'align' => 'center') @@ -234,10 +182,10 @@ # Generate the top-level file for the HTML user manual. def generateHTMLindex(directory) html = HTMLDocument.new(:frameset) html << (head = XMLElement.new('head')) - head << (e = XMLNamedText.new("The #{AppConfig.packageName} User Manual", + head << (e = XMLNamedText.new("The #{AppConfig.softwareName} User Manual", 'title')) head << XMLElement.new('meta', 'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8') html << (frameset = XMLElement.new('frameset', 'cols' => '15%, 85%'))