2 eval 'exec perl -S $0 ${1+"$@"}'
3 if $running_under_some_shell;
5 # Usage: rofftoc PerlTOC.xxx.raw
7 # Post-processes roffitall output. Called from roffitall to produce
8 # a formatted table of contents.
10 # Author: Tom Christiansen
18 .tl ''\fB\s+2Perl Table of Contents\s0\fR''
24 .tl ''\fB\s+5Perl Table of Contents\s0\fR''
32 ($type, $page, $desc) = split ' ', $_, 3;
33 $desc =~ s/^"(.*)"$/$1/;
34 if ($type eq 'Title') {
35 ($name = $desc) =~ s/ .*//;
37 } elsif ($type eq 'Name') {
38 #print STDERR $page, "\t", $desc;
46 } elsif ($type eq 'Header') {
47 print ".br\n", $page, "\t", $desc;
48 } elsif ($type eq 'Subsection') {
49 print ".br\n", $page, "\t\t", $desc;
50 } elsif ($type eq 'Item') {
51 next if $desc =~ /\\bu/;
52 next unless $name =~ /POSIX|func/i;
53 print ".br\n", $page, "\t\t\t", $desc;
57 Index:Title 1 "PERL 1"
58 Index:Name 1 "perl - Practical Extraction and Report Language"
60 Index:Header 1 "SYNOPSIS"
61 Index:Header 2 "DESCRIPTION"
62 Index:Item 2 "\(bu Many usability enhancements"
63 Index:Item 2 "\(bu Simplified grammar"
64 Index:Item 2 "\(bu Lexical scoping"
65 Index:Item 2 "\(bu Arbitrarily nested data structures"
66 Index:Item 2 "\(bu Modularity and reusability"