Updated for eximstats 1.52
[exim.git] / doc / doc-docbook / TidyInfo
CommitLineData
4f578862
PH
1#! /usr/bin/perl -w
2
3# $Cambridge: exim/doc/doc-docbook/TidyInfo,v 1.1 2006/04/04 14:03:49 ph10 Exp $
4
5# This is script to tidy up the Texinfo file that docbook2texi produces. We
6# have to change "conceptindex" and "optionindex" to "cindex" and "findex", and
7# we also have to add access to the index into the menus and a final node.
8
9# Find the start of the first menu.
10
11while (<>)
12 {
13 print;
14 last if /^\@menu/;
15 }
16
17# Find the end of the first menu.
18
19while (<>)
20 {
21 last if /^$/;
22 print;
23 }
24
25# Insert a menu link to the index.
26
27print "* Concept Index::\n\n";
28
29# Find the final @bye line. En route, we look for the last chapter node, the
30# one that has nothing following, and insert a pointer to an index node. Also,
31# change the index names.
32
33while (<>)
34 {
35 last if /^\@bye/;
36 if (/^\@node ([^,]+), , (.*)/)
37 {
38 my($save1) = $1;
39 my($save2) = $2;
40 my($saveline) = $_;
41 $_ = <>;
42 if (/^\@chapter/)
43 {
44 print "\@node $save1, Concept Index, $save2\n";
45 $previous = $save1;
46 }
47 else
48 {
49 print "$saveline";
50 }
51 print;
52 }
53 else
54 {
55 s/conceptindex/cindex/;
56 s/optionindex/findex/;
57 print;
58 }
59 }
60
61# Insert the final index stuff at the end.
62
63print "\@appendix\n";
64print "\@node Concept Index, , $previous, Top\n";
65print "\n\@printindex cp\n\n";
66
67print;
68
69# End