Documentation cherry-pick: Fix cut-and-paste error
[git/platforms/storm.git] / Documentation / cat-texi.perl
blobe3d8e9faa8c4b64c757080b89f304f78d30fbc17
1 #!/usr/bin/perl -w
3 my @menu = ();
4 my $output = $ARGV[0];
6 open TMP, '>', "$output.tmp";
8 while (<STDIN>) {
9 next if (/^\\input texinfo/../\@node Top/);
10 next if (/^\@bye/ || /^\.ft/);
11 if (s/^\@top (.*)/\@node $1,,,Top/) {
12 push @menu, $1;
14 s/\(\@pxref{\[URLS\]}\)//;
15 print TMP;
17 close TMP;
19 printf '\input texinfo
20 @setfilename gitman.info
21 @documentencoding us-ascii
22 @node Top,,%s
23 @top Git Manual Pages
24 @documentlanguage en
25 @menu
26 ', $menu[0];
28 for (@menu) {
29 print "* ${_}::\n";
31 print "\@end menu\n";
32 open TMP, '<', "$output.tmp";
33 while (<TMP>) {
34 print;
36 close TMP;
37 print "\@bye\n";
38 unlink "$output.tmp";