Debian Codegraph @

hmmer/easel/devkit/rmanprocess.pl

raw
1 #! /usr/bin/perl
2
3 # rmanprocess.pl <rman LaTeX2e output>
4 #
5 # Example:
6 # rman -f LaTeX2e foo.man | rmanprocess.pl > foo.tex
7 #
8 # Converts a man page to a HMMER User's Guide section.
9 # Written to operate with PolyglotMan v3.0.5, by Thomas Phelps
10 # Obtain from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z
11 #
12 # - removes document declarations
13 # - removes See Also and Author sections, if present
14 # - converts sections to subsections
15 # - adds a subsection declaration for program name
16 #
17 #
18 # SRE, Mon May 25 11:06:58 1998
19
20 while (<>)
21 {
22 if (/--/) { s/--/{-}{-}/g; }
23
24 if (/^\\documentclass/) {
25 print "\\setlength{\\sresavei}{\\parindent}\n";
26 print "\\setlength{\\sresaves}{\\parskip}\n";
27 next;
28 }
29 if (/^\\begin\{document\}/) { next; }
30
31 if (/^\s*\\section\{See/ || /^\\end\{document\}/) {
32 print "\\setlength{\\parindent}{\\sresavei}\n";
33 print "\\setlength{\\parskip}{\\sresaves}\n";
34 print "\\newpage";
35 last;
36 }
37
38 if (/\\begin\{itemize\}/ || /\\end\{itemize\}/) {
39 s/itemize/wideitem/;
40 print;
41 next;
42 }
43
44 if (/^\\section\{Name/) {
45 while (<>) { # get one-line "foo - a program to do bar"
46 if (/^(\S+)\s+-\s+(.+)$/) { print "\\subsection{\\texttt{$1} - $2}\n"; }
47 elsif (/^\\section/) { last; }
48 }
49 }
50
51 # while ($line = <>) {
52 # if ($line =~ /\\begin\{itemize\}/) { last; }
53 # }
54 # while ($line = <>) { # get item
55 #
56 #
57 # last;
58 # } elsif ($line =~ /^\\item\s*\[(\S+)\s*-\s*(.+)/) {
59 # print "\\subsection{\\texttt{$1} - $2}\n";
60 # last;
61 # }
62 # }
63 # while (<>) {
64 # if (/\\end\{itemize\}/) { last; }
65 # }
66 # next;
67
68 if (/^\\section/) {
69 s/section/subsubsection/;
70 print;
71 next;
72 }
73
74 print;
75
76 }