class CTioga2::Commands::Documentation::Markup

A class dumping markup information to standard output

Attributes

doc[RW]

The Doc object the Markup class should dump

Public Class Methods

new(doc) click to toggle source
# File lib/ctioga2/commands/doc/markup.rb, line 350
def initialize(doc)
  @doc = doc
end

Public Instance Methods

dump_markup(items) click to toggle source
# File lib/ctioga2/commands/doc/markup.rb, line 382
def dump_markup(items)
  if items.is_a? String 
    mup = MarkedUpText.new(@doc, items)
    return dump_markup(mup.elements)
  end
  return items.map { |x| "-> #{x.dump_string}\n"}
end
write_commands(out = STDOUT) click to toggle source

Dumps the markup of all commands

# File lib/ctioga2/commands/doc/markup.rb, line 355
def write_commands(out = STDOUT)
  cmds, groups = @doc.documented_commands

  for g in groups
    out.puts "Group markup: #{g.name}"
    out.puts dump_markup(g.description)

    commands = cmds[g].sort {|a,b|
      a.name <=> b.name
    }
    
    for cmd in commands
      out.puts "Command: #{cmd.name}"
      out.puts dump_markup(cmd.long_description)
    end
  end
end
write_types(out = STDOUT) click to toggle source

Dumps the markup of all types

# File lib/ctioga2/commands/doc/markup.rb, line 374
def write_types(out = STDOUT)
  types = @doc.types.sort.map { |d| d[1]}
  for t in types
    out.puts "Type: #{t.name}"
    out.puts dump_markup(t.description)
  end
end