lib/ctioga2/commands/doc/man.rb in ctioga2-0.0 vs lib/ctioga2/commands/doc/man.rb in ctioga2-0.1
- old
+ new
@@ -16,11 +16,11 @@
require 'ctioga2/commands/commands'
require 'ctioga2/commands/parsers/command-line'
module CTioga2
- Version::register_svn_info('$Revision: 40 $', '$Date: 2009-05-08 00:45:47 +0200 (Fri, 08 May 2009) $')
+ Version::register_svn_info('$Revision: 213 $', '$Date: 2010-12-31 02:50:00 +0100 (Fri, 31 Dec 2010) $')
module Commands
module Documentation
@@ -43,10 +43,11 @@
# Writes a manual page to the given _io_ stream, using _version_
# as the target version (the one ending up in the headers).
#
# NO... We should *input* a manual page, and spit out
# replacement texts.
+ #
def write_manual_page(version, input, out = STDOUT)
passed_header = false
if input.is_a? String
filename = input
input = File::open(input)
@@ -65,16 +66,17 @@
when /^#{RoffCommentRE}\s*write-header\s*$/
out.puts header_string(version, filename)
passed_header = true
when /^#{RoffCommentRE}\s*write-commands\s*$/
write_commands(out)
+ # \todo add a write-backends command....
when /^#{RoffCommentRE}\s*write-group:\s*(.*)\s*$/
id = $1
if @groups[id]
write_group(out, g)
else
- warn "Unkown group: #{id}"
+ warn { "Unkown group: #{id}" }
end
when /^#{RoffCommentRE}\s*write-types\s*$/
write_types(out)
else
if passed_header
@@ -95,16 +97,16 @@
# Takes up an array of MarkupItem objects and returns its
# equivalent in roff format. Alternativelely, it can take a
# String and feed it to MarkedUpText.
#
- # TODO: make sure things are escaped the way they should be.
+ # \todo make sure things are escaped the way they should be.
#
# if _inside_cmds_ is true, additional indentation is added
# for the lists, so that is looks neat in the end.
#
- # TODO: try to be more clever about spaces in the target
+ # \todo try to be more clever about spaces in the target
# file. (does not matter too much for the output of man)
def markup_to_man(items, inside_cmds = true)
if items.is_a? String
mup = MarkedUpText.new(@doc, items)
return markup_to_man(mup.elements, inside_cmds)
@@ -240,10 +242,10 @@
end
def write_type(out, type, indent = "")
out.puts ".TP #{indent}"
out.puts ".I #{type.name}"
- out.puts "#{type.description}"
+ out.puts markup_to_man(type.description)
end
# Returns the header string
def header_string(version, file)
return ManualPageHeader % [ file,