Merge branch 'dp/maint-rebase-fix' into maint
[tgit.git] / Documentation / cat-texi.perl
blobdbc133cd3c1f19dd507014477e68b8ada78eab5e
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|REMOTES)\]}\)//;
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";