Debian Codegraph @

doc/option_to_tex

raw
1 #! /usr/bin/env ruby
2
3 exit 1 if ARGV[0].nil?
4
5 require 'rubygems'
6 require 'treetop'
7
8
9 def quote(str)
10 str.gsub(/_/, "\\_")
11 end
12 require 'help_parse.rb'
13
14
15 class IsOpen
16 attr_accessor :is_open
17 def initialize
18 @is_open = false
19 end
20 end
21 opened = IsOpen.new
22
23
24 parser = HelpGrammarParser.new
25 open(ARGV[0]) { |fd|
26 fd.each { |l|
27 r = parser.parse(l)
28 if r.nil?
29 raise "Got nil for: #{l}"
30 else
31 puts r.to_tex(opened)
32 end
33 }
34 puts("\\end{description}") if opened.is_open
35 }