This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlop: Remove obsolete text
[perl5.git] / pod / rofftoc
1 # Usage: rofftoc PerlTOC.xxx.raw
2 #
3 # Post-processes roffitall output. Called from roffitall to produce
4 # a formatted table of contents.
5 #
6 # Author: Tom Christiansen
7
8 print <<'EOF';
9 .de NP
10 '.sp 0.8i
11 .tl ''- % -''
12 'bp
13 'sp 0.5i
14 .tl ''\fB\s+2Perl Table of Contents\s0\fR''
15 'sp 0.3i
16 ..
17 .wh -1i NP
18 .af % i
19 .sp 0.5i
20 .tl ''\fB\s+5Perl Table of Contents\s0\fR''
21 .sp 0.5i
22 .nf
23 .na
24 EOF
25 while (<>) {
26     #chomp;
27     s/Index://;
28     ($type, $page, $desc) = split ' ', $_, 3;
29     $desc =~ s/^"(.*)"$/$1/;
30     if      ($type eq 'Title') {
31         ($name = $desc) =~ s/ .*//;
32         next;
33     } elsif ($type eq 'Name') {
34         #print STDERR  $page, "\t", $desc;
35         print ".ne 5\n";
36         print ".in 0\n";
37         print ".sp\n";
38         print ".ft B\n";
39         print "$desc\n";
40         print ".ft P\n";
41         print ".in 5n\n";
42     } elsif ($type eq 'Header') {
43         print ".br\n", $page, "\t", $desc;
44     } elsif ($type eq 'Subsection') {
45         print ".br\n", $page, "\t\t", $desc;
46     } elsif ($type eq 'Item') {
47         next if $desc =~ /\\bu/;
48         next unless $name =~ /POSIX|func/i;
49         print ".br\n", $page, "\t\t\t", $desc;
50     }
51
52 __END__
53 Index:Title     1       "PERL 1"
54 Index:Name      1       "perl - Practical Extraction and Report Language"
55 Index:Header    1       "NAME"
56 Index:Header    1       "SYNOPSIS"
57 Index:Header    2       "DESCRIPTION"
58 Index:Item      2       "\(bu Many usability enhancements"
59 Index:Item      2       "\(bu Simplified grammar"
60 Index:Item      2       "\(bu Lexical scoping"
61 Index:Item      2       "\(bu Arbitrarily nested data structures"
62 Index:Item      2       "\(bu Modularity and reusability"