maildir_tag hint provided by Heiko Schlittermann.
[exim.git] / doc / doc-docbook / TidyInfo
1 #! /usr/bin/perl -w
2
3 # $Cambridge: exim/doc/doc-docbook/TidyInfo,v 1.2 2007/04/17 13:06:09 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
11 while (<>)
12 {
13 print;
14 last if /^\@menu/;
15 }
16
17 # Find the end of the first menu.
18
19 while (<>)
20 {
21 last if /^$/;
22 print;
23 }
24
25 # Insert a menu link to the index.
26
27 print "* 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
33 while (<>)
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 s/variableindex/findex/;
58 print;
59 }
60 }
61
62 # Insert the final index stuff at the end.
63
64 print "\@appendix\n";
65 print "\@node Concept Index, , $previous, Top\n";
66 print "\n\@printindex cp\n\n";
67
68 print;
69
70 # End