taskjuggler 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +280 -0
- data/README +31 -0
- data/Rakefile +20 -0
- data/benchmarks/UTF-8-Strings.rb +58 -0
- data/benchmarks/allocate.tjp +30 -0
- data/benchmarks/booking.tjp +62 -0
- data/benchmarks/depends.tjp +112 -0
- data/benchmarks/htmltaskreport.tjp +45 -0
- data/benchmarks/runbench.rb +24 -0
- data/bin/tj3 +3 -0
- data/bin/tj3man +3 -0
- data/doc/classes/AppConfig.html +808 -0
- data/doc/classes/Arguments.html +226 -0
- data/doc/classes/String.html +395 -0
- data/doc/classes/TaskJuggler.html +1358 -0
- data/doc/classes/TaskJuggler/Account.html +257 -0
- data/doc/classes/TaskJuggler/AccountScenario.html +218 -0
- data/doc/classes/TaskJuggler/Allocation.html +419 -0
- data/doc/classes/TaskJuggler/AllocationAttribute.html +291 -0
- data/doc/classes/TaskJuggler/AttributeBase.html +608 -0
- data/doc/classes/TaskJuggler/AttributeDefinition.html +259 -0
- data/doc/classes/TaskJuggler/Booking.html +307 -0
- data/doc/classes/TaskJuggler/BookingListAttribute.html +263 -0
- data/doc/classes/TaskJuggler/BooleanAttribute.html +261 -0
- data/doc/classes/TaskJuggler/CSVFile.html +325 -0
- data/doc/classes/TaskJuggler/Charge.html +279 -0
- data/doc/classes/TaskJuggler/ChargeListAttribute.html +229 -0
- data/doc/classes/TaskJuggler/ChargeSet.html +440 -0
- data/doc/classes/TaskJuggler/ChargeSetListAttribute.html +276 -0
- data/doc/classes/TaskJuggler/ColumnTable.html +260 -0
- data/doc/classes/TaskJuggler/DateAttribute.html +194 -0
- data/doc/classes/TaskJuggler/DependencyListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/DurationAttribute.html +229 -0
- data/doc/classes/TaskJuggler/FixnumAttribute.html +194 -0
- data/doc/classes/TaskJuggler/FlagListAttribute.html +263 -0
- data/doc/classes/TaskJuggler/FloatAttribute.html +229 -0
- data/doc/classes/TaskJuggler/GanttChart.html +667 -0
- data/doc/classes/TaskJuggler/GanttContainer.html +441 -0
- data/doc/classes/TaskJuggler/GanttHeader.html +280 -0
- data/doc/classes/TaskJuggler/GanttHeaderScaleItem.html +245 -0
- data/doc/classes/TaskJuggler/GanttLine.html +398 -0
- data/doc/classes/TaskJuggler/GanttLoadStack.html +327 -0
- data/doc/classes/TaskJuggler/GanttMilestone.html +415 -0
- data/doc/classes/TaskJuggler/GanttRouter.html +425 -0
- data/doc/classes/TaskJuggler/GanttTaskBar.html +429 -0
- data/doc/classes/TaskJuggler/HTMLDocument.html +240 -0
- data/doc/classes/TaskJuggler/HTMLGraphics.html +231 -0
- data/doc/classes/TaskJuggler/Interval.html +552 -0
- data/doc/classes/TaskJuggler/IntervalListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/KeywordDocumentation.html +796 -0
- data/doc/classes/TaskJuggler/Limits.html +416 -0
- data/doc/classes/TaskJuggler/Limits/Limit.html +381 -0
- data/doc/classes/TaskJuggler/LimitsAttribute.html +261 -0
- data/doc/classes/TaskJuggler/Log.html +613 -0
- data/doc/classes/TaskJuggler/LogicalAttribute.html +226 -0
- data/doc/classes/TaskJuggler/LogicalExpression.html +251 -0
- data/doc/classes/TaskJuggler/LogicalFlag.html +229 -0
- data/doc/classes/TaskJuggler/LogicalFunction.html +324 -0
- data/doc/classes/TaskJuggler/LogicalOperation.html +299 -0
- data/doc/classes/TaskJuggler/Macro.html +194 -0
- data/doc/classes/TaskJuggler/MacroParser.html +360 -0
- data/doc/classes/TaskJuggler/MacroTable.html +366 -0
- data/doc/classes/TaskJuggler/Message.html +281 -0
- data/doc/classes/TaskJuggler/MessageHandler.html +215 -0
- data/doc/classes/TaskJuggler/Project.html +1606 -0
- data/doc/classes/TaskJuggler/ProjectFileParser.html +412 -0
- data/doc/classes/TaskJuggler/PropertyList.html +597 -0
- data/doc/classes/TaskJuggler/PropertySet.html +1200 -0
- data/doc/classes/TaskJuggler/PropertyTreeNode.html +1449 -0
- data/doc/classes/TaskJuggler/Query.html +600 -0
- data/doc/classes/TaskJuggler/RealFormat.html +252 -0
- data/doc/classes/TaskJuggler/ReferenceAttribute.html +194 -0
- data/doc/classes/TaskJuggler/Report.html +528 -0
- data/doc/classes/TaskJuggler/ReportElement.html +1070 -0
- data/doc/classes/TaskJuggler/ReportTable.html +497 -0
- data/doc/classes/TaskJuggler/ReportTableCell.html +518 -0
- data/doc/classes/TaskJuggler/ReportTableColumn.html +364 -0
- data/doc/classes/TaskJuggler/ReportTableElement.html +644 -0
- data/doc/classes/TaskJuggler/ReportTableLegend.html +343 -0
- data/doc/classes/TaskJuggler/ReportTableLine.html +431 -0
- data/doc/classes/TaskJuggler/Resource.html +211 -0
- data/doc/classes/TaskJuggler/ResourceListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/ResourceListRE.html +249 -0
- data/doc/classes/TaskJuggler/ResourceScenario.html +1137 -0
- data/doc/classes/TaskJuggler/RichText.html +537 -0
- data/doc/classes/TaskJuggler/RichTextAttribute.html +229 -0
- data/doc/classes/TaskJuggler/RichTextDocument.html +418 -0
- data/doc/classes/TaskJuggler/RichTextElement.html +829 -0
- data/doc/classes/TaskJuggler/RichTextException.html +212 -0
- data/doc/classes/TaskJuggler/RichTextParser.html +317 -0
- data/doc/classes/TaskJuggler/RichTextProtocolExample.html +303 -0
- data/doc/classes/TaskJuggler/RichTextProtocolHandler.html +194 -0
- data/doc/classes/TaskJuggler/RichTextScanner.html +561 -0
- data/doc/classes/TaskJuggler/RichTextSnip.html +364 -0
- data/doc/classes/TaskJuggler/RichTextSyntaxRules.html +883 -0
- data/doc/classes/TaskJuggler/Scenario.html +163 -0
- data/doc/classes/TaskJuggler/ScenarioData.html +354 -0
- data/doc/classes/TaskJuggler/Scoreboard.html +638 -0
- data/doc/classes/TaskJuggler/Shift.html +255 -0
- data/doc/classes/TaskJuggler/ShiftAssignment.html +488 -0
- data/doc/classes/TaskJuggler/ShiftAssignments.html +715 -0
- data/doc/classes/TaskJuggler/ShiftAssignmentsAttribute.html +261 -0
- data/doc/classes/TaskJuggler/ShiftScenario.html +282 -0
- data/doc/classes/TaskJuggler/SourceFileInfo.html +247 -0
- data/doc/classes/TaskJuggler/StringAttribute.html +229 -0
- data/doc/classes/TaskJuggler/SymbolAttribute.html +194 -0
- data/doc/classes/TaskJuggler/SyntaxReference.html +516 -0
- data/doc/classes/TaskJuggler/TOCEntry.html +242 -0
- data/doc/classes/TaskJuggler/TableColumnDefinition.html +273 -0
- data/doc/classes/TaskJuggler/TableOfContents.html +256 -0
- data/doc/classes/TaskJuggler/Task.html +203 -0
- data/doc/classes/TaskJuggler/TaskDependency.html +251 -0
- data/doc/classes/TaskJuggler/TaskListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/TaskListRE.html +250 -0
- data/doc/classes/TaskJuggler/TaskScenario.html +2206 -0
- data/doc/classes/TaskJuggler/TextParser.html +670 -0
- data/doc/classes/TaskJuggler/TextParser/Pattern.html +923 -0
- data/doc/classes/TaskJuggler/TextParser/Rule.html +779 -0
- data/doc/classes/TaskJuggler/TextParser/StackElement.html +267 -0
- data/doc/classes/TaskJuggler/TextParser/TextParserResultArray.html +212 -0
- data/doc/classes/TaskJuggler/TextParser/TokenDoc.html +221 -0
- data/doc/classes/TaskJuggler/TextScanner.html +708 -0
- data/doc/classes/TaskJuggler/TextScanner/BufferStreamHandle.html +355 -0
- data/doc/classes/TaskJuggler/TextScanner/FileStreamHandle.html +341 -0
- data/doc/classes/TaskJuggler/TextScanner/StreamHandle.html +260 -0
- data/doc/classes/TaskJuggler/TjException.html +185 -0
- data/doc/classes/TaskJuggler/TjTime.html +1845 -0
- data/doc/classes/TaskJuggler/TjpExample.html +310 -0
- data/doc/classes/TaskJuggler/TjpExportRE.html +329 -0
- data/doc/classes/TaskJuggler/TjpSyntaxRules.html +8928 -0
- data/doc/classes/TaskJuggler/UserManual.html +606 -0
- data/doc/classes/TaskJuggler/WorkingHours.html +582 -0
- data/doc/classes/TaskJuggler/WorkingHoursAttribute.html +284 -0
- data/doc/classes/TaskJuggler/XMLBlob.html +207 -0
- data/doc/classes/TaskJuggler/XMLComment.html +206 -0
- data/doc/classes/TaskJuggler/XMLDocument.html +293 -0
- data/doc/classes/TaskJuggler/XMLElement.html +341 -0
- data/doc/classes/TaskJuggler/XMLNamedText.html +174 -0
- data/doc/classes/TaskJuggler/XMLText.html +221 -0
- data/doc/files/COPYING.html +448 -0
- data/doc/files/README.html +134 -0
- data/doc/files/lib/AccountScenario_rb.html +116 -0
- data/doc/files/lib/Account_rb.html +118 -0
- data/doc/files/lib/Allocation_rb.html +118 -0
- data/doc/files/lib/AppConfig_rb.html +116 -0
- data/doc/files/lib/AttributeBase_rb.html +106 -0
- data/doc/files/lib/AttributeDefinition_rb.html +106 -0
- data/doc/files/lib/Attributes_rb.html +130 -0
- data/doc/files/lib/Booking_rb.html +106 -0
- data/doc/files/lib/ChargeSet_rb.html +116 -0
- data/doc/files/lib/Charge_rb.html +116 -0
- data/doc/files/lib/HTMLDocument_rb.html +116 -0
- data/doc/files/lib/Interval_rb.html +116 -0
- data/doc/files/lib/KeywordDocumentation_rb.html +122 -0
- data/doc/files/lib/Limits_rb.html +116 -0
- data/doc/files/lib/Log_rb.html +116 -0
- data/doc/files/lib/LogicalExpression_rb.html +122 -0
- data/doc/files/lib/LogicalFlag_rb.html +116 -0
- data/doc/files/lib/LogicalFunction_rb.html +116 -0
- data/doc/files/lib/LogicalOperation_rb.html +116 -0
- data/doc/files/lib/MacroParser_rb.html +118 -0
- data/doc/files/lib/MacroTable_rb.html +122 -0
- data/doc/files/lib/MessageHandler_rb.html +106 -0
- data/doc/files/lib/Message_rb.html +116 -0
- data/doc/files/lib/ProjectFileParser_rb.html +122 -0
- data/doc/files/lib/Project_rb.html +148 -0
- data/doc/files/lib/PropertyList_rb.html +106 -0
- data/doc/files/lib/PropertySet_rb.html +118 -0
- data/doc/files/lib/PropertyTreeNode_rb.html +106 -0
- data/doc/files/lib/Query_rb.html +116 -0
- data/doc/files/lib/RealFormat_rb.html +106 -0
- data/doc/files/lib/ResourceScenario_rb.html +116 -0
- data/doc/files/lib/Resource_rb.html +118 -0
- data/doc/files/lib/RichTextDocument_rb.html +120 -0
- data/doc/files/lib/RichTextElement_rb.html +120 -0
- data/doc/files/lib/RichTextParser_rb.html +120 -0
- data/doc/files/lib/RichTextProtocolExample_rb.html +120 -0
- data/doc/files/lib/RichTextProtocolHandler_rb.html +106 -0
- data/doc/files/lib/RichTextScanner_rb.html +116 -0
- data/doc/files/lib/RichTextSnip_rb.html +118 -0
- data/doc/files/lib/RichTextSyntaxRules_rb.html +106 -0
- data/doc/files/lib/RichText_rb.html +118 -0
- data/doc/files/lib/ScenarioData_rb.html +118 -0
- data/doc/files/lib/Scenario_rb.html +116 -0
- data/doc/files/lib/Scoreboard_rb.html +106 -0
- data/doc/files/lib/ShiftAssignments_rb.html +116 -0
- data/doc/files/lib/ShiftScenario_rb.html +116 -0
- data/doc/files/lib/Shift_rb.html +118 -0
- data/doc/files/lib/SourceFileInfo_rb.html +106 -0
- data/doc/files/lib/SyntaxReference_rb.html +122 -0
- data/doc/files/lib/TOCEntry_rb.html +118 -0
- data/doc/files/lib/TableColumnDefinition_rb.html +106 -0
- data/doc/files/lib/TableOfContents_rb.html +118 -0
- data/doc/files/lib/TaskDependency_rb.html +106 -0
- data/doc/files/lib/TaskJuggler_rb.html +120 -0
- data/doc/files/lib/TaskScenario_rb.html +116 -0
- data/doc/files/lib/Task_rb.html +118 -0
- data/doc/files/lib/TextParser/Pattern_rb.html +116 -0
- data/doc/files/lib/TextParser/Rule_rb.html +106 -0
- data/doc/files/lib/TextParser/StackElement_rb.html +106 -0
- data/doc/files/lib/TextParser/TokenDoc_rb.html +106 -0
- data/doc/files/lib/TextParser_rb.html +124 -0
- data/doc/files/lib/TextScanner_rb.html +128 -0
- data/doc/files/lib/Tj3Config_rb.html +118 -0
- data/doc/files/lib/TjException_rb.html +106 -0
- data/doc/files/lib/TjTime_rb.html +118 -0
- data/doc/files/lib/TjpExample_rb.html +116 -0
- data/doc/files/lib/TjpSyntaxRules_rb.html +106 -0
- data/doc/files/lib/UTF8String_rb.html +132 -0
- data/doc/files/lib/UserManual_rb.html +124 -0
- data/doc/files/lib/WorkingHours_rb.html +116 -0
- data/doc/files/lib/XMLDocument_rb.html +116 -0
- data/doc/files/lib/XMLElement_rb.html +116 -0
- data/doc/files/lib/reports/CSVFile_rb.html +116 -0
- data/doc/files/lib/reports/ColumnTable_rb.html +116 -0
- data/doc/files/lib/reports/GanttChart_rb.html +122 -0
- data/doc/files/lib/reports/GanttContainer_rb.html +116 -0
- data/doc/files/lib/reports/GanttHeaderScaleItem_rb.html +106 -0
- data/doc/files/lib/reports/GanttHeader_rb.html +116 -0
- data/doc/files/lib/reports/GanttLine_rb.html +126 -0
- data/doc/files/lib/reports/GanttLoadStack_rb.html +116 -0
- data/doc/files/lib/reports/GanttMilestone_rb.html +116 -0
- data/doc/files/lib/reports/GanttRouter_rb.html +106 -0
- data/doc/files/lib/reports/GanttTaskBar_rb.html +116 -0
- data/doc/files/lib/reports/HTMLGraphics_rb.html +106 -0
- data/doc/files/lib/reports/ReportElement_rb.html +118 -0
- data/doc/files/lib/reports/ReportTableCell_rb.html +106 -0
- data/doc/files/lib/reports/ReportTableColumn_rb.html +106 -0
- data/doc/files/lib/reports/ReportTableElement_rb.html +122 -0
- data/doc/files/lib/reports/ReportTableLegend_rb.html +106 -0
- data/doc/files/lib/reports/ReportTableLine_rb.html +116 -0
- data/doc/files/lib/reports/ReportTable_rb.html +118 -0
- data/doc/files/lib/reports/Report_rb.html +126 -0
- data/doc/files/lib/reports/ResourceListRE_rb.html +122 -0
- data/doc/files/lib/reports/TaskListRE_rb.html +122 -0
- data/doc/files/lib/reports/TjpExportRE_rb.html +116 -0
- data/doc/files/lib/taskjuggler3_rb.html +276 -0
- data/doc/files/lib/tj3man_rb.html +189 -0
- data/doc/fr_class_index.html +285 -0
- data/doc/fr_file_index.html +223 -0
- data/doc/fr_method_index.html +1953 -0
- data/doc/index.html +21 -0
- data/doc/rdoc-style.css +299 -0
- data/examples/tutorial.tjp +361 -0
- data/gem_spec.rb +30 -0
- data/lib/Account.rb +50 -0
- data/lib/AccountScenario.rb +39 -0
- data/lib/Allocation.rb +102 -0
- data/lib/AppConfig.rb +134 -0
- data/lib/AttributeBase.rb +131 -0
- data/lib/AttributeDefinition.rb +47 -0
- data/lib/Attributes.rb +478 -0
- data/lib/BatchProcessor.rb +209 -0
- data/lib/Booking.rb +59 -0
- data/lib/Charge.rb +71 -0
- data/lib/ChargeSet.rb +126 -0
- data/lib/HTMLDocument.rb +59 -0
- data/lib/Interval.rb +127 -0
- data/lib/KeywordDocumentation.rb +560 -0
- data/lib/Limits.rb +219 -0
- data/lib/Log.rb +160 -0
- data/lib/LogicalExpression.rb +71 -0
- data/lib/LogicalFlag.rb +34 -0
- data/lib/LogicalFunction.rb +102 -0
- data/lib/LogicalOperation.rb +118 -0
- data/lib/MacroParser.rb +77 -0
- data/lib/MacroTable.rb +84 -0
- data/lib/Message.rb +56 -0
- data/lib/MessageHandler.rb +34 -0
- data/lib/Project.rb +662 -0
- data/lib/ProjectFileParser.rb +333 -0
- data/lib/PropertyList.rb +181 -0
- data/lib/PropertySet.rb +304 -0
- data/lib/PropertyTreeNode.rb +461 -0
- data/lib/Query.rb +227 -0
- data/lib/RealFormat.rb +73 -0
- data/lib/Resource.rb +42 -0
- data/lib/ResourceScenario.rb +511 -0
- data/lib/RichText.rb +147 -0
- data/lib/RichTextDocument.rb +139 -0
- data/lib/RichTextElement.rb +391 -0
- data/lib/RichTextParser.rb +66 -0
- data/lib/RichTextProtocolExample.rb +65 -0
- data/lib/RichTextProtocolHandler.rb +35 -0
- data/lib/RichTextScanner.rb +390 -0
- data/lib/RichTextSnip.rb +104 -0
- data/lib/RichTextSyntaxRules.rb +265 -0
- data/lib/Scenario.rb +27 -0
- data/lib/ScenarioData.rb +65 -0
- data/lib/Scoreboard.rb +141 -0
- data/lib/Shift.rb +48 -0
- data/lib/ShiftAssignments.rb +291 -0
- data/lib/ShiftScenario.rb +46 -0
- data/lib/SourceFileInfo.rb +37 -0
- data/lib/SyntaxReference.rb +284 -0
- data/lib/TOCEntry.rb +76 -0
- data/lib/TableColumnDefinition.rb +54 -0
- data/lib/TableOfContents.rb +46 -0
- data/lib/Task.rb +37 -0
- data/lib/TaskDependency.rb +39 -0
- data/lib/TaskJuggler.rb +84 -0
- data/lib/TaskScenario.rb +1622 -0
- data/lib/TextParser.rb +416 -0
- data/lib/TextParser/Pattern.rb +263 -0
- data/lib/TextParser/Rule.rb +171 -0
- data/lib/TextParser/StackElement.rb +45 -0
- data/lib/TextParser/TokenDoc.rb +38 -0
- data/lib/TextScanner.rb +682 -0
- data/lib/Tj3Config.rb +27 -0
- data/lib/TjException.rb +27 -0
- data/lib/TjTime.rb +395 -0
- data/lib/TjpExample.rb +119 -0
- data/lib/TjpSyntaxRules.rb +4022 -0
- data/lib/UTF8String.rb +100 -0
- data/lib/UserManual.rb +282 -0
- data/lib/WorkingHours.rb +323 -0
- data/lib/XMLDocument.rb +54 -0
- data/lib/XMLElement.rb +175 -0
- data/lib/reports/CSVFile.rb +146 -0
- data/lib/reports/ColumnTable.rb +66 -0
- data/lib/reports/GanttChart.rb +308 -0
- data/lib/reports/GanttContainer.rb +107 -0
- data/lib/reports/GanttHeader.rb +141 -0
- data/lib/reports/GanttHeaderScaleItem.rb +42 -0
- data/lib/reports/GanttLine.rb +329 -0
- data/lib/reports/GanttLoadStack.rb +113 -0
- data/lib/reports/GanttMilestone.rb +80 -0
- data/lib/reports/GanttRouter.rb +375 -0
- data/lib/reports/GanttTaskBar.rb +95 -0
- data/lib/reports/HTMLGraphics.rb +65 -0
- data/lib/reports/Report.rb +344 -0
- data/lib/reports/ReportElement.rb +427 -0
- data/lib/reports/ReportTable.rb +144 -0
- data/lib/reports/ReportTableCell.rb +142 -0
- data/lib/reports/ReportTableColumn.rb +82 -0
- data/lib/reports/ReportTableElement.rb +852 -0
- data/lib/reports/ReportTableLegend.rb +167 -0
- data/lib/reports/ReportTableLine.rb +87 -0
- data/lib/reports/ResourceListRE.rb +72 -0
- data/lib/reports/TaskListRE.rb +73 -0
- data/lib/reports/TjpExportRE.rb +394 -0
- data/lib/taskjuggler3.rb +106 -0
- data/lib/tj3man.rb +88 -0
- data/manual/Day_To_Day_Juggling +168 -0
- data/manual/Getting_Started +61 -0
- data/manual/How_To_Contribute +185 -0
- data/manual/Installation +68 -0
- data/manual/Intro +102 -0
- data/manual/Reporting_Bugs +26 -0
- data/manual/Rich_Text_Attributes +90 -0
- data/manual/TaskJuggler_2x_Migration +40 -0
- data/manual/Tutorial +579 -0
- data/manual/fdl +450 -0
- data/prj_cfg.rb +43 -0
- data/setup.rb +1585 -0
- data/tasks/csts.rake +72 -0
- data/tasks/gem.rake +14 -0
- data/tasks/manual.rake +10 -0
- data/tasks/missing.rake +21 -0
- data/tasks/rcov.rake +14 -0
- data/tasks/rdoc.rake +17 -0
- data/tasks/rexml_fix.rb +16 -0
- data/tasks/rexml_fix_19.rb +49 -0
- data/tasks/show.rake +21 -0
- data/tasks/stats.rake +25 -0
- data/tasks/test.rake +11 -0
- data/test/MessageChecker.rb +53 -0
- data/test/TestSuite/CSV-Reports/celltext-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/celltext.tjp +7 -0
- data/test/TestSuite/CSV-Reports/genrefs +6 -0
- data/test/TestSuite/CSV-Reports/project-1.tji +57 -0
- data/test/TestSuite/CSV-Reports/resourcereport-Reference.csv +4 -0
- data/test/TestSuite/CSV-Reports/resourcereport.tjp +10 -0
- data/test/TestSuite/CSV-Reports/resourcereport_with_tasks-Reference.csv +22 -0
- data/test/TestSuite/CSV-Reports/resourcereport_with_tasks.tjp +11 -0
- data/test/TestSuite/CSV-Reports/sortByTree-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortByTree.tjp +8 -0
- data/test/TestSuite/CSV-Reports/sortBy_duration.down-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortBy_duration.down.tjp +10 -0
- data/test/TestSuite/CSV-Reports/sortBy_effort.up-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortBy_effort.up.tjp +10 -0
- data/test/TestSuite/CSV-Reports/sortBy_plan.start.down-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortBy_plan.start.down.tjp +10 -0
- data/test/TestSuite/CSV-Reports/taskreport-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/taskreport.tjp +10 -0
- data/test/TestSuite/CSV-Reports/taskreport_with_resources-Reference.csv +24 -0
- data/test/TestSuite/CSV-Reports/taskreport_with_resources.tjp +11 -0
- data/test/TestSuite/Scheduler/Correct/Allocate.tjp +86 -0
- data/test/TestSuite/Scheduler/Correct/AutomaticMilestones.tjp +63 -0
- data/test/TestSuite/Scheduler/Correct/Booking.tjp +161 -0
- data/test/TestSuite/Scheduler/Correct/Depends.tjp +50 -0
- data/test/TestSuite/Scheduler/Correct/Duration.tjp +34 -0
- data/test/TestSuite/Scheduler/Correct/InheritStartEnd.tjp +129 -0
- data/test/TestSuite/Scheduler/Correct/Limits.tjp +81 -0
- data/test/TestSuite/Scheduler/Correct/MultipleMandatories.tjp +43 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-1.tjp +28 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-2.tjp +33 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-3.tjp +33 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-4.tjp +34 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-5.tjp +62 -0
- data/test/TestSuite/Scheduler/Correct/Precedes.tjp +50 -0
- data/test/TestSuite/Scheduler/Correct/Shift.tjp +102 -0
- data/test/TestSuite/Scheduler/Errors/account_no_leaf.tjp +13 -0
- data/test/TestSuite/Scheduler/Errors/booking_conflict.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/booking_no_duty.tjp +9 -0
- data/test/TestSuite/Scheduler/Errors/booking_on_vacation.tjp +9 -0
- data/test/TestSuite/Scheduler/Errors/container_booking.tjp +14 -0
- data/test/TestSuite/Scheduler/Errors/container_duration.tjp +11 -0
- data/test/TestSuite/Scheduler/Errors/effort_no_allocations.tjp +7 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_1.tjp +19 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_10.tjp +36 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_11.tjp +27 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_12.tjp +20 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_13.tjp +27 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_14.tjp +26 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_2.tjp +24 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_3.tjp +18 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_4.tjp +36 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_5.tjp +37 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_6.tjp +35 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_7.tjp +46 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_8.tjp +51 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_9.tjp +20 -0
- data/test/TestSuite/Scheduler/Errors/maxend.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/maxstart.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/milestone_booking.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/milestone_duration.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/milestone_start_end.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/minend.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/minstart.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/multiple_durations.tjp +11 -0
- data/test/TestSuite/Scheduler/Errors/no_tasks.tjp +6 -0
- data/test/TestSuite/Scheduler/Errors/not_scheduled.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_child.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_multi.tjp +13 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_parent.tjp +11 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_self.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_unknown.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/task_overspecified_1.tjp +9 -0
- data/test/TestSuite/Scheduler/Errors/task_overspecified_2.tjp +14 -0
- data/test/TestSuite/Scheduler/Errors/task_overspecified_3.tjp +14 -0
- data/test/TestSuite/Scheduler/Errors/task_underspecified_1.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/task_underspecified_2.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/task_underspecified_3.tjp +9 -0
- data/test/TestSuite/Syntax/Correct/Account.tjp +53 -0
- data/test/TestSuite/Syntax/Correct/Allocate-1.tjp +24 -0
- data/test/TestSuite/Syntax/Correct/Alternative.tjp +13 -0
- data/test/TestSuite/Syntax/Correct/AutoMacros.tjp +14 -0
- data/test/TestSuite/Syntax/Correct/Booking.tjp +26 -0
- data/test/TestSuite/Syntax/Correct/Caption.tjp +33 -0
- data/test/TestSuite/Syntax/Correct/Celltext.tjp +28 -0
- data/test/TestSuite/Syntax/Correct/Comments.tjp +29 -0
- data/test/TestSuite/Syntax/Correct/Complete.tjp +16 -0
- data/test/TestSuite/Syntax/Correct/CompletedWork.tji +20 -0
- data/test/TestSuite/Syntax/Correct/CriticalPath.tjp +31 -0
- data/test/TestSuite/Syntax/Correct/Currencyformat.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/CustomAttributes.tjp +14 -0
- data/test/TestSuite/Syntax/Correct/Depends1.tjp +22 -0
- data/test/TestSuite/Syntax/Correct/Durations.tjp +29 -0
- data/test/TestSuite/Syntax/Correct/Efficiency.tjp +19 -0
- data/test/TestSuite/Syntax/Correct/Export.tjp +40 -0
- data/test/TestSuite/Syntax/Correct/Flags.tjp +32 -0
- data/test/TestSuite/Syntax/Correct/Freeze.tjp +28 -0
- data/test/TestSuite/Syntax/Correct/Gap.tjp +15 -0
- data/test/TestSuite/Syntax/Correct/HtmlTaskReport.tjp +33 -0
- data/test/TestSuite/Syntax/Correct/Limits-1.tjp +71 -0
- data/test/TestSuite/Syntax/Correct/LoadUnits.tjp +31 -0
- data/test/TestSuite/Syntax/Correct/Macro-1.tjp +19 -0
- data/test/TestSuite/Syntax/Correct/Mandatory.tjp +17 -0
- data/test/TestSuite/Syntax/Correct/Milestone.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/MinMax.tjp +17 -0
- data/test/TestSuite/Syntax/Correct/Numberformat.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/Period.tjp +16 -0
- data/test/TestSuite/Syntax/Correct/Persistent.tjp +11 -0
- data/test/TestSuite/Syntax/Correct/Precedes1.tjp +17 -0
- data/test/TestSuite/Syntax/Correct/Priority.tjp +30 -0
- data/test/TestSuite/Syntax/Correct/Project.tjp +21 -0
- data/test/TestSuite/Syntax/Correct/ProjectIDs.tjp +23 -0
- data/test/TestSuite/Syntax/Correct/RawHTML.tjp +29 -0
- data/test/TestSuite/Syntax/Correct/Reports.tjp +54 -0
- data/test/TestSuite/Syntax/Correct/Resource.tjp +20 -0
- data/test/TestSuite/Syntax/Correct/Responsible.tjp +16 -0
- data/test/TestSuite/Syntax/Correct/Scenario.tjp +15 -0
- data/test/TestSuite/Syntax/Correct/Scheduling.tjp +26 -0
- data/test/TestSuite/Syntax/Correct/Select.tjp +27 -0
- data/test/TestSuite/Syntax/Correct/Shift.tjp +55 -0
- data/test/TestSuite/Syntax/Correct/Simple.tjp +25 -0
- data/test/TestSuite/Syntax/Correct/String.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/Supplement.tjp +24 -0
- data/test/TestSuite/Syntax/Correct/TaskRoot.tjp +34 -0
- data/test/TestSuite/Syntax/Correct/TimeFrame.tjp +19 -0
- data/test/TestSuite/Syntax/Correct/Timezone.tjp +8 -0
- data/test/TestSuite/Syntax/Correct/Vacation.tjp +33 -0
- data/test/TestSuite/Syntax/Correct/csvtest +16 -0
- data/test/TestSuite/Syntax/Correct/manual2example.rb +24 -0
- data/test/TestSuite/Syntax/Correct/tutorial.tjp +485 -0
- data/test/TestSuite/Syntax/Errors/bad_include.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/booking_group.tjp +14 -0
- data/test/TestSuite/Syntax/Errors/booking_milestone.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/booking_no_leaf.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/chargeset.tjp +14 -0
- data/test/TestSuite/Syntax/Errors/chargeset_master.tjp +15 -0
- data/test/TestSuite/Syntax/Errors/container_attribute.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/cost_acct_no_top.tjp +24 -0
- data/test/TestSuite/Syntax/Errors/cost_rev_same.tjp +24 -0
- data/test/TestSuite/Syntax/Errors/date_in_range.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/effort_zero.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/empty.tjp +1 -0
- data/test/TestSuite/Syntax/Errors/export_bad_extn.tjp +9 -0
- data/test/TestSuite/Syntax/Errors/extend_id_cap.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/interval_end_in_range.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/interval_start_in_range.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/leaf_resource_id_expected.tjp +12 -0
- data/test/TestSuite/Syntax/Errors/misaligned_date.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/no_csv_suffix.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/no_html_suffix.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/operand_attribute.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/operand_unkn_flag.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/operand_unkn_scen.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/overtime_range.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/purge_no_list.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/purge_unknown_id.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/report_end.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/report_redifinition.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/report_start.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/resource_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/resource_id_expected.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/rev_acct_no_top.tjp +24 -0
- data/test/TestSuite/Syntax/Errors/scenario_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/shift_assignment_overlap.tjp +15 -0
- data/test/TestSuite/Syntax/Errors/shift_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/shift_id_expected.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/sloppy_range.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/sort_direction.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sort_unknown_scen.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sorting_crit_exptd1.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sorting_crit_exptd2.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sorting_wbs.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/start_before_end1.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/start_before_end2.tjp +6 -0
- data/test/TestSuite/Syntax/Errors/task_complete.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/task_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/task_priority.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/task_without_chargeset.tjp +9 -0
- data/test/TestSuite/Syntax/Errors/time_interval.tjp +12 -0
- data/test/TestSuite/Syntax/Errors/too_many_bangs.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/undecl_flag.tjp +6 -0
- data/test/TestSuite/Syntax/Errors/unknown_projectid.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/unknown_scenario_id.tjp +6 -0
- data/test/TestSuite/Syntax/Errors/unknown_scenario_idx.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/unknown_task.tjp +10 -0
- data/test/all.rb +31 -0
- data/test/test_BatchProcessor.rb +54 -0
- data/test/test_CSV-Reports.rb +101 -0
- data/test/test_Limits.rb +104 -0
- data/test/test_LogicalExpression.rb +110 -0
- data/test/test_MacroTable.rb +51 -0
- data/test/test_Project.rb +57 -0
- data/test/test_PropertySet.rb +71 -0
- data/test/test_Query.rb +83 -0
- data/test/test_RealFormat.rb +83 -0
- data/test/test_RichText.rb +869 -0
- data/test/test_Scheduler.rb +42 -0
- data/test/test_ShiftAssignments.rb +77 -0
- data/test/test_Syntax.rb +41 -0
- data/test/test_TextScanner.rb +95 -0
- data/test/test_TjTime.rb +114 -0
- data/test/test_TjpExample.rb +169 -0
- data/test/test_UTF8String.rb +84 -0
- data/test/test_WorkingHours.rb +56 -0
- metadata +649 -0
data/lib/RichText.rb
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# = RichText.rb -- The TaskJuggler III Project Management Software
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of version 2 of the GNU General Public License as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'RichTextElement'
|
14
|
+
require 'RichTextParser'
|
15
|
+
|
16
|
+
class TaskJuggler
|
17
|
+
|
18
|
+
# RichText is a MediaWiki markup parser and HTML generator implemented in
|
19
|
+
# pure Ruby. It can also generate plain text versions of the original markup
|
20
|
+
# text. It is based on the TextParser class to implement the
|
21
|
+
# RichTextParser. The scanner is implemented in the RichTextScanner class.
|
22
|
+
# The read-in text is converted into a tree of RichTextElement objects.
|
23
|
+
# These can then be turned into HTML element trees modelled by XMLElement or
|
24
|
+
# plain text.
|
25
|
+
#
|
26
|
+
# This class supports the following mark-ups:
|
27
|
+
#
|
28
|
+
# The following markups are block commands and must start at the beginning of
|
29
|
+
# the line.
|
30
|
+
#
|
31
|
+
# == Headline 1 ==
|
32
|
+
# === Headline 2 ===
|
33
|
+
# ==== Headline 3 ====
|
34
|
+
#
|
35
|
+
# ---- creates a horizontal line
|
36
|
+
#
|
37
|
+
# * Bullet 1
|
38
|
+
# ** Bullet 2
|
39
|
+
# *** Bullet 3
|
40
|
+
#
|
41
|
+
# # Enumeration Level 1
|
42
|
+
# ## Enumeration Level 2
|
43
|
+
# ### Enumeration Level 3
|
44
|
+
#
|
45
|
+
# Preformatted text start with
|
46
|
+
# a single space at the start of
|
47
|
+
# each line.
|
48
|
+
#
|
49
|
+
#
|
50
|
+
# The following are in-line mark-ups and can occur within any text block
|
51
|
+
#
|
52
|
+
# This is an ''italic'' word.
|
53
|
+
# This is a '''bold''' word.
|
54
|
+
# This is a ''''monospaced'''' word. This is not part of the original
|
55
|
+
# MediaWiki markup, but we needed monospaced as well.
|
56
|
+
# This is a '''''italic and bold''''' word.
|
57
|
+
#
|
58
|
+
# Linebreaks are ignored if not followed by a blank line.
|
59
|
+
#
|
60
|
+
# [http://www.taskjuggler.org] A web link
|
61
|
+
# [http://www.taskjuggler.org The TaskJuggler Web Site] another link
|
62
|
+
#
|
63
|
+
# [[item]] site internal internal reference (in HTML .html gets appended
|
64
|
+
# automatically)
|
65
|
+
# [[item An item]] another internal reference
|
66
|
+
# [[protocol:path arg1 arg2 ...]]
|
67
|
+
#
|
68
|
+
# <nowiki> ... </nowiki> Disable markup interpretation for the enclosed
|
69
|
+
# portion of text.
|
70
|
+
#
|
71
|
+
class RichText
|
72
|
+
|
73
|
+
attr_accessor :sectionNumbers, :lineWidth
|
74
|
+
|
75
|
+
# Create a rich text object by passing a String with markup elements to it.
|
76
|
+
# _text_ must be plain text with MediaWiki compatible markup elements. In
|
77
|
+
# case an error occurs, an exception of type TjException will be raised.
|
78
|
+
def initialize(text, sectionCounter = [ 0, 0, 0] )
|
79
|
+
# Set this to false to disable automatically generated section numbers.
|
80
|
+
@sectionNumbers = true
|
81
|
+
# Set this to the width of your text area. Needed for horizonal lines.
|
82
|
+
@lineWidth = 80
|
83
|
+
# These are the RichTextProtocolHandler objects to handle references with
|
84
|
+
# a protocol specification.
|
85
|
+
@protocolHandlers = {}
|
86
|
+
parser = RichTextParser.new(self, sectionCounter)
|
87
|
+
parser.open(text)
|
88
|
+
# Parse the input text and convert it to the intermediate representation.
|
89
|
+
@richText = parser.parse('richtext')
|
90
|
+
# In case the result is empty, use an empty RichTextElement as result
|
91
|
+
@richText = RichTextElement.new(@richText, :richtext, nil) unless @richText
|
92
|
+
@richText.cleanUp
|
93
|
+
end
|
94
|
+
|
95
|
+
# Use this function to register new RichTextProtocolHandler objects with
|
96
|
+
# this class.
|
97
|
+
def registerProtocol(protocolHandler)
|
98
|
+
@protocolHandlers[protocolHandler.protocol] = protocolHandler
|
99
|
+
end
|
100
|
+
|
101
|
+
# Use this function to register a set of RichTextProtocolHandler objects
|
102
|
+
# with this class. This will replace any previously registered handlers.
|
103
|
+
def setProtocolHandlers(protocolHandlers)
|
104
|
+
@protocolHandlers = protocolHandlers
|
105
|
+
end
|
106
|
+
|
107
|
+
# Return the handler for the given _protocol_ or raise an exception if it
|
108
|
+
# does not exist.
|
109
|
+
def protocolHandler(protocol)
|
110
|
+
unless @protocolHandlers.include?(protocol)
|
111
|
+
raise TjException.new, "Unsupported protocol #{protocol}"
|
112
|
+
end
|
113
|
+
@protocolHandlers[protocol]
|
114
|
+
end
|
115
|
+
|
116
|
+
# Return a TableOfContents for the section headings.
|
117
|
+
def tableOfContents(toc, fileName)
|
118
|
+
@richText.tableOfContents(toc, fileName)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Return an Array with all other snippet names that are referenced by
|
122
|
+
# internal references in this RichText object.
|
123
|
+
def internalReferences
|
124
|
+
@richText.internalReferences
|
125
|
+
end
|
126
|
+
|
127
|
+
# Convert the rich text to plain ASCII text. All elements that can't be
|
128
|
+
# represented easily in ASCII Strings are ommitted.
|
129
|
+
def to_s
|
130
|
+
@richText.to_s
|
131
|
+
end
|
132
|
+
|
133
|
+
# Convert the rich text to HTML elements.
|
134
|
+
def to_html
|
135
|
+
@richText.to_html
|
136
|
+
end
|
137
|
+
|
138
|
+
# Convert the rich text to an ASCII version with HTML like markup tags. This
|
139
|
+
# is probably only usefull for the unit test.
|
140
|
+
def to_tagged #:nodoc:
|
141
|
+
@richText.to_tagged
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
@@ -0,0 +1,139 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# = RichTextDocument.rb -- The TaskJuggler III Project Management Software
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of version 2 of the GNU General Public License as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'RichTextSnip'
|
14
|
+
require 'TableOfContents'
|
15
|
+
require 'RichTextProtocolHandler'
|
16
|
+
|
17
|
+
class TaskJuggler
|
18
|
+
|
19
|
+
# A RichTextDocument object collect a set of structured text files into a
|
20
|
+
# single document. This document may have a consistent table of contents
|
21
|
+
# across all files and can be turned into a set of corresponding HTML files.
|
22
|
+
# This class is an abstract class. To use it, a derrived class must define
|
23
|
+
# the functions generateHTMLCover, generateStyleSheet, generateHTMLHeader
|
24
|
+
# and generateHTMLFooter.
|
25
|
+
class RichTextDocument
|
26
|
+
|
27
|
+
attr_reader :protocolHandlers
|
28
|
+
|
29
|
+
# Create a new empty RichTextDocument object.
|
30
|
+
def initialize
|
31
|
+
@protocolHandlers = {}
|
32
|
+
@snippets = []
|
33
|
+
@dirty = false
|
34
|
+
@sectionCounter = [ 0, 0, 0 ]
|
35
|
+
@toc = nil
|
36
|
+
end
|
37
|
+
|
38
|
+
# Register a new RichTextProtocolHandler for this document.
|
39
|
+
def registerProtocolHandler(handler)
|
40
|
+
@protocolHandlers[handler.protocol] = handler
|
41
|
+
end
|
42
|
+
|
43
|
+
# Add a new structured text file to the document. _file_ must be the name of
|
44
|
+
# a file with RichText compatible syntax elements.
|
45
|
+
def addSnip(file)
|
46
|
+
@snippets << RichTextSnip.new(self, file, @sectionCounter)
|
47
|
+
@dirty = true
|
48
|
+
end
|
49
|
+
|
50
|
+
# Call this method to generate a table of contents for all files that were
|
51
|
+
# registered so far. The table of contents is stored internally and will be
|
52
|
+
# used when the document is produced in a new format. This function also
|
53
|
+
# collects a list of all snip names to @snipNames and gathers a list of
|
54
|
+
# all references to other snippets in @references. As these two lists will
|
55
|
+
# be used by RichTextDocument#checkInternalReferences this function must be
|
56
|
+
# called first.
|
57
|
+
def tableOfContents
|
58
|
+
@toc = TableOfContents.new
|
59
|
+
@references = {}
|
60
|
+
@snipNames = []
|
61
|
+
@snippets.each do |snip|
|
62
|
+
snip.tableOfContents(@toc, snip.name)
|
63
|
+
@snipNames << snip.name
|
64
|
+
(refs = snip.internalReferences).empty? ||
|
65
|
+
@references[snip.name] = refs
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Make sure that all internal references only point to known snippets.
|
70
|
+
def checkInternalReferences
|
71
|
+
@references.each do |snip, refs|
|
72
|
+
refs.each do |reference|
|
73
|
+
unless @snipNames.include?(reference)
|
74
|
+
# TODO: Probably an Exception is cleaner here.
|
75
|
+
puts "Warning: Rich text file #{snip} references unknown " +
|
76
|
+
"object #{reference}"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Generate HTML files for all registered text files. The files have the same
|
83
|
+
# name as the orginal files with '.html' appended. The files will be
|
84
|
+
# generated into the _directory_. _directory_ must be empty or a valid path
|
85
|
+
# name that is terminated with a '/'. A table of contense is generated into
|
86
|
+
# a file called 'toc.html'.
|
87
|
+
def generateHTML(directory = '')
|
88
|
+
crossReference
|
89
|
+
|
90
|
+
generateHTMLTableOfContents(directory)
|
91
|
+
|
92
|
+
@snippets.each do |snip|
|
93
|
+
snip.generateHTML(directory)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
# Register the previous and next file with each of the text files. This
|
100
|
+
# function is used by the output generators to have links to the next and
|
101
|
+
# previous file in the sequence embedded into the generated files.
|
102
|
+
def crossReference
|
103
|
+
return unless @dirty
|
104
|
+
|
105
|
+
prevSnip = nil
|
106
|
+
@snippets.each do |snip|
|
107
|
+
if prevSnip
|
108
|
+
snip.prevSnip = prevSnip
|
109
|
+
prevSnip.nextSnip = snip
|
110
|
+
end
|
111
|
+
prevSnip = snip
|
112
|
+
end
|
113
|
+
|
114
|
+
@dirty = false
|
115
|
+
end
|
116
|
+
|
117
|
+
# Generate a HTML file with the table of contense for all registered files.
|
118
|
+
def generateHTMLTableOfContents(directory)
|
119
|
+
html = HTMLDocument.new
|
120
|
+
html << (head = XMLElement.new('head'))
|
121
|
+
head << XMLNamedText.new('Index', 'title') <<
|
122
|
+
XMLElement.new('meta', 'http-equiv' => 'Content-Type',
|
123
|
+
'content' => 'text/html; charset=utf-8')
|
124
|
+
html << (body = XMLElement.new('body'))
|
125
|
+
|
126
|
+
body << generateHTMLCover <<
|
127
|
+
@toc.to_html <<
|
128
|
+
XMLElement.new('br') <<
|
129
|
+
XMLElement.new('hr') <<
|
130
|
+
XMLElement.new('br') <<
|
131
|
+
generateHTMLFooter
|
132
|
+
|
133
|
+
html.write(directory + 'toc.html')
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
@@ -0,0 +1,391 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# = RichTextElement.rb -- The TaskJuggler III Project Management Software
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of version 2 of the GNU General Public License as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'UTF8String'
|
14
|
+
require 'TjException'
|
15
|
+
require 'XMLElement'
|
16
|
+
|
17
|
+
class TaskJuggler
|
18
|
+
|
19
|
+
# The RichTextElement class models the nodes of the intermediate
|
20
|
+
# representation that the RichTextParser generates. Each node can reference an
|
21
|
+
# Array of other RichTextElement nodes, building a tree that represents the
|
22
|
+
# syntactical structure of the parsed RichText. Each node has a certain
|
23
|
+
# category that identifies the content of the node.
|
24
|
+
class RichTextElement
|
25
|
+
|
26
|
+
attr_reader :category, :children
|
27
|
+
attr_writer :data
|
28
|
+
attr_accessor :appendSpace
|
29
|
+
|
30
|
+
# Create a new RichTextElement node. _rt_ is the RichText object this
|
31
|
+
# element belongs to. _category_ is the type of the node. It can be :title,
|
32
|
+
# :bold, etc. _arg_ is an overloaded argument. It can either be another node
|
33
|
+
# or an Array of RichTextElement nodes.
|
34
|
+
def initialize(rt, category, arg = nil)
|
35
|
+
@richText = rt
|
36
|
+
@category = category
|
37
|
+
if arg
|
38
|
+
if arg.is_a?(Array)
|
39
|
+
@children = arg
|
40
|
+
else
|
41
|
+
unless arg.is_a?(RichTextElement) || arg.is_a?(String)
|
42
|
+
raise TjException.new,
|
43
|
+
"Element must be of type RichTextElement instead of #{arg.class}"
|
44
|
+
end
|
45
|
+
@children = [ arg ]
|
46
|
+
end
|
47
|
+
else
|
48
|
+
@children = []
|
49
|
+
end
|
50
|
+
|
51
|
+
# Certain elements such as titles,references and numbered bullets can be
|
52
|
+
# require additional data. This variable is used for this. It can hold an
|
53
|
+
# Array of counters or a link label.
|
54
|
+
@data = nil
|
55
|
+
@appendSpace = false
|
56
|
+
end
|
57
|
+
|
58
|
+
# Remove a paragraph node from the richtext node if it is the only node in
|
59
|
+
# richtext. The paragraph children will become richtext children.
|
60
|
+
def cleanUp
|
61
|
+
if @category == :richtext && @children.length == 1 &&
|
62
|
+
@children[0].category == :paragraph
|
63
|
+
@children = @children[0].children
|
64
|
+
end
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
68
|
+
# Recursively extract the section headings from the RichTextElement and
|
69
|
+
# build fill the TableOfContents _toc_ with the gathered sections.
|
70
|
+
# _fileName_ is the base name (without .html or other suffix) of the file
|
71
|
+
# the TOCEntries should point to.
|
72
|
+
def tableOfContents(toc, fileName)
|
73
|
+
number = nil
|
74
|
+
case @category
|
75
|
+
when :title1
|
76
|
+
number = "#{@data[0]} "
|
77
|
+
when :title2
|
78
|
+
number = "#{@data[0]}.#{@data[1]} "
|
79
|
+
when :title3
|
80
|
+
number = "#{@data[0]}.#{@data[1]}.#{@data[2]} "
|
81
|
+
end
|
82
|
+
if number
|
83
|
+
# We've found a section heading. The String value of the Element is the
|
84
|
+
# title.
|
85
|
+
title = children_to_s
|
86
|
+
tag = convertToID(title)
|
87
|
+
toc.addEntry(TOCEntry.new(number, title, fileName, tag))
|
88
|
+
else
|
89
|
+
# Recursively extract the TOC from the child objects.
|
90
|
+
@children.each do |el|
|
91
|
+
el.tableOfContents(toc, fileName) if el.is_a?(RichTextElement)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
toc
|
96
|
+
end
|
97
|
+
|
98
|
+
# Return an Array with all other snippet names that are referenced by
|
99
|
+
# internal references in this RichTextElement.
|
100
|
+
def internalReferences
|
101
|
+
references = []
|
102
|
+
if @category == :ref && !@data.include?(':')
|
103
|
+
references << @data
|
104
|
+
else
|
105
|
+
@children.each do |el|
|
106
|
+
if el.is_a?(RichTextElement)
|
107
|
+
references += el.internalReferences
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# We only need each reference once.
|
113
|
+
references.uniq
|
114
|
+
end
|
115
|
+
|
116
|
+
# Conver the intermediate representation into a plain text again. All
|
117
|
+
# elements that can't be represented in plain text easily will be ignored or
|
118
|
+
# just their value will be included.
|
119
|
+
def to_s
|
120
|
+
pre = ''
|
121
|
+
post = ''
|
122
|
+
case @category
|
123
|
+
when :richtext
|
124
|
+
when :title1
|
125
|
+
pre = "#{@data[0]} "
|
126
|
+
post = "\n\n"
|
127
|
+
when :title2
|
128
|
+
pre = "#{@data[0]}.#{@data[1]} "
|
129
|
+
post = "\n\n"
|
130
|
+
when :title3
|
131
|
+
pre = "#{@data[0]}.#{@data[1]}.#{@data[2]} "
|
132
|
+
post = "\n\n"
|
133
|
+
when :hline
|
134
|
+
return "#{'-' * (@richText.lineWidth - 4)}\n"
|
135
|
+
when :paragraph
|
136
|
+
post = "\n\n"
|
137
|
+
when :pre
|
138
|
+
post = "\n"
|
139
|
+
when :bulletlist1
|
140
|
+
when :bulletitem1
|
141
|
+
pre = '* '
|
142
|
+
post = "\n\n"
|
143
|
+
when :bulletlist2
|
144
|
+
when :bulletitem2
|
145
|
+
pre = ' * '
|
146
|
+
post = "\n\n"
|
147
|
+
when :bulletlist3
|
148
|
+
when :bulletitem3
|
149
|
+
pre = ' * '
|
150
|
+
post = "\n\n"
|
151
|
+
when :numberlist1
|
152
|
+
when :numberitem1
|
153
|
+
pre = "#{@data[0]} "
|
154
|
+
post = "\n\n"
|
155
|
+
when :numberlist2
|
156
|
+
when :numberitem2
|
157
|
+
pre = "#{@data[0]}.#{@data[1]} "
|
158
|
+
post = "\n\n"
|
159
|
+
when :numberlist3
|
160
|
+
when :numberitem3
|
161
|
+
pre = "#{@data[0]}.#{@data[1]}.#{@data[2]} "
|
162
|
+
post = "\n\n"
|
163
|
+
when :ref
|
164
|
+
when :href
|
165
|
+
when :italic
|
166
|
+
when :bold
|
167
|
+
when :code
|
168
|
+
when :text
|
169
|
+
else
|
170
|
+
raise TjException.new, "Unknown RichTextElement category #{@category}"
|
171
|
+
end
|
172
|
+
|
173
|
+
pre + children_to_s + post
|
174
|
+
end
|
175
|
+
|
176
|
+
# Convert the tree of RichTextElement nodes into an XML like text
|
177
|
+
# representation. This is primarily intended for unit testing. The tag names
|
178
|
+
# are similar to HTML tags, but this is not meant to be valid HTML.
|
179
|
+
def to_tagged
|
180
|
+
pre = ''
|
181
|
+
post = ''
|
182
|
+
case @category
|
183
|
+
when :richtext
|
184
|
+
pre = '<div>'
|
185
|
+
post = '</div>'
|
186
|
+
when :title1
|
187
|
+
pre = "<h1>#{@data[0]} "
|
188
|
+
post = "</h1>\n\n"
|
189
|
+
when :title2
|
190
|
+
pre = "<h2>#{@data[0]}.#{@data[1]} "
|
191
|
+
post = "</h2>\n\n"
|
192
|
+
when :title3
|
193
|
+
pre = "<h3>#{@data[0]}.#{@data[1]}.#{@data[2]} "
|
194
|
+
post = "</h3>\n\n"
|
195
|
+
when :hline
|
196
|
+
pre = '<hr>'
|
197
|
+
post = "</hr>\n"
|
198
|
+
when :paragraph
|
199
|
+
pre = '<p>'
|
200
|
+
post = "</p>\n\n"
|
201
|
+
when :pre
|
202
|
+
pre = '<pre>'
|
203
|
+
post = "</pre>\n\n"
|
204
|
+
when :bulletlist1
|
205
|
+
pre = '<ul>'
|
206
|
+
post = '</ul>'
|
207
|
+
when :bulletitem1
|
208
|
+
pre = '<li>* '
|
209
|
+
post = "</li>\n"
|
210
|
+
when :bulletlist2
|
211
|
+
pre = '<ul>'
|
212
|
+
post = '</ul>'
|
213
|
+
when :bulletitem2
|
214
|
+
pre = '<li> * '
|
215
|
+
post = "</li>\n"
|
216
|
+
when :bulletlist3
|
217
|
+
pre = '<ul>'
|
218
|
+
post = '</ul>'
|
219
|
+
when :bulletitem3
|
220
|
+
pre = '<li> * '
|
221
|
+
post = "</li>\n"
|
222
|
+
when :numberlist1
|
223
|
+
pre = '<ol>'
|
224
|
+
post = '</ol>'
|
225
|
+
when :numberitem1
|
226
|
+
pre = "<li>#{@data[0]} "
|
227
|
+
post = "</li>\n"
|
228
|
+
when :numberlist2
|
229
|
+
pre = '<ol>'
|
230
|
+
post = '</ol>'
|
231
|
+
when :numberitem2
|
232
|
+
pre = "<li>#{@data[0]}.#{@data[1]} "
|
233
|
+
post = "</li>\n"
|
234
|
+
when :numberlist3
|
235
|
+
pre = '<ol>'
|
236
|
+
post = '</ol>'
|
237
|
+
when :numberitem3
|
238
|
+
pre = "<li>#{@data[0]}.#{@data[1]}.#{@data[2]} "
|
239
|
+
post = "</li>\n"
|
240
|
+
when :ref
|
241
|
+
pre = "<ref data=\"#{@data}\">"
|
242
|
+
post = '</ref>'
|
243
|
+
when :href
|
244
|
+
pre = "<a href=\"#{@data}\" target=\"_blank\">"
|
245
|
+
post = '</a>'
|
246
|
+
when :italic
|
247
|
+
pre = '<i>'
|
248
|
+
post = '</i>'
|
249
|
+
when :bold
|
250
|
+
pre = '<b>'
|
251
|
+
post = '</b>'
|
252
|
+
when :code
|
253
|
+
pre = '<code>'
|
254
|
+
post = '</code>'
|
255
|
+
when :text
|
256
|
+
pre = '['
|
257
|
+
post = ']'
|
258
|
+
else
|
259
|
+
raise TjException.new, "Unknown RichTextElement category #{@category}"
|
260
|
+
end
|
261
|
+
|
262
|
+
out = ''
|
263
|
+
@children.each do |el|
|
264
|
+
if el.is_a?(RichTextElement)
|
265
|
+
out << el.to_tagged + (el.appendSpace ? ' ' : '')
|
266
|
+
else
|
267
|
+
out << el.to_s
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
pre + out + post
|
272
|
+
end
|
273
|
+
|
274
|
+
# Convert the intermediate representation into HTML elements.
|
275
|
+
def to_html
|
276
|
+
html =
|
277
|
+
case @category
|
278
|
+
when :richtext
|
279
|
+
XMLElement.new('div')
|
280
|
+
when :title1
|
281
|
+
el = XMLElement.new('h1', 'id' => convertToID(children_to_s))
|
282
|
+
if @richText.sectionNumbers
|
283
|
+
el << XMLText.new("#{@data[0]} ")
|
284
|
+
end
|
285
|
+
el
|
286
|
+
when :title2
|
287
|
+
el = XMLElement.new('h2', 'id' => convertToID(children_to_s))
|
288
|
+
if @richText.sectionNumbers
|
289
|
+
el << XMLText.new("#{@data[0]}.#{@data[1]} ")
|
290
|
+
end
|
291
|
+
el
|
292
|
+
when :title3
|
293
|
+
el = XMLElement.new('h3', 'id' => convertToID(children_to_s))
|
294
|
+
if @richText.sectionNumbers
|
295
|
+
el << XMLText.new("#{@data[0]}.#{@data[1]}.#{@data[2]} ")
|
296
|
+
end
|
297
|
+
el
|
298
|
+
when :hline
|
299
|
+
XMLElement.new('hr')
|
300
|
+
when :paragraph
|
301
|
+
XMLElement.new('p')
|
302
|
+
when :pre
|
303
|
+
pre = XMLElement.new('pre')
|
304
|
+
pre << XMLText.new(@children[0])
|
305
|
+
when :bulletlist1
|
306
|
+
XMLElement.new('ul')
|
307
|
+
when :bulletitem1
|
308
|
+
XMLElement.new('li')
|
309
|
+
when :bulletlist2
|
310
|
+
XMLElement.new('ul')
|
311
|
+
when :bulletitem2
|
312
|
+
XMLElement.new('li')
|
313
|
+
when :bulletlist3
|
314
|
+
XMLElement.new('ul')
|
315
|
+
when :bulletitem3
|
316
|
+
XMLElement.new('li')
|
317
|
+
when :numberlist1
|
318
|
+
XMLElement.new('ol')
|
319
|
+
when :numberitem1
|
320
|
+
XMLElement.new('li')
|
321
|
+
when :numberlist2
|
322
|
+
XMLElement.new('ol')
|
323
|
+
when :numberitem2
|
324
|
+
XMLElement.new('li')
|
325
|
+
when :numberlist3
|
326
|
+
XMLElement.new('ol')
|
327
|
+
when :numberitem3
|
328
|
+
XMLElement.new('li')
|
329
|
+
when :ref
|
330
|
+
if @data.include?(':')
|
331
|
+
protocol, path = @data.split(':')
|
332
|
+
raise TjException.new, "Reference protocol empty." if protocol.empty?
|
333
|
+
if path.empty?
|
334
|
+
raise TjException.new, "Reference path may not be empty."
|
335
|
+
end
|
336
|
+
args = children_to_s.split(' ')
|
337
|
+
return @richText.protocolHandler(protocol).to_html(path, args)
|
338
|
+
else
|
339
|
+
XMLElement.new('a', 'href' => "#{@data}.html")
|
340
|
+
end
|
341
|
+
when :href
|
342
|
+
XMLElement.new('a', 'href' => @data, 'target' => '_blank')
|
343
|
+
when :italic
|
344
|
+
XMLElement.new('i')
|
345
|
+
when :bold
|
346
|
+
XMLElement.new('b')
|
347
|
+
when :code
|
348
|
+
XMLElement.new('code')
|
349
|
+
when :text
|
350
|
+
XMLText.new(@children[0])
|
351
|
+
else
|
352
|
+
raise TjException.new, "Unknown RichTextElement category #{@category}"
|
353
|
+
end
|
354
|
+
|
355
|
+
# Some elements never have leaves.
|
356
|
+
return html if [ :text, :pre, :hline ].include?(@category)
|
357
|
+
|
358
|
+
@children.each do |el_i|
|
359
|
+
html << el_i.to_html
|
360
|
+
html << XMLText.new(' ') if el_i.appendSpace
|
361
|
+
end
|
362
|
+
|
363
|
+
html
|
364
|
+
end
|
365
|
+
|
366
|
+
# Convert all childern into a single plain text String.
|
367
|
+
def children_to_s
|
368
|
+
text = ''
|
369
|
+
@children.each do |c|
|
370
|
+
text << c.to_s + (c.is_a?(RichTextElement) && c.appendSpace ? ' ' : '')
|
371
|
+
end
|
372
|
+
text
|
373
|
+
end
|
374
|
+
|
375
|
+
# This function converts a String into a new String that only contains
|
376
|
+
# characters that are acceptable for HTML tag IDs.
|
377
|
+
def convertToID(text)
|
378
|
+
out = ''
|
379
|
+
text.each_utf8_char do |c|
|
380
|
+
out << c if (c >= 'A' && c <= 'Z') ||
|
381
|
+
(c >= 'a' && c <= 'z') ||
|
382
|
+
(c >= '0' && c <= '9')
|
383
|
+
out << '_' if c == ' '
|
384
|
+
end
|
385
|
+
out.chomp('_')
|
386
|
+
end
|
387
|
+
|
388
|
+
end
|
389
|
+
|
390
|
+
end
|
391
|
+
|