Documentation / cat-texi.perlon commit Merge branch 'jc/apply-whitespace' (0dbaa5b)
   1#!/usr/bin/perl -w
   2
   3my @menu = ();
   4my $output = $ARGV[0];
   5
   6open TMP, '>', "$output.tmp";
   7
   8while (<STDIN>) {
   9        next if (/^\\input texinfo/../\@node Top/);
  10        next if (/^\@bye/ || /^\.ft/);
  11        if (s/^\@top (.*)/\@node $1,,,Top/) {
  12                push @menu, $1;
  13        }
  14        s/\(\@pxref{\[URLS\]}\)//;
  15        print TMP;
  16}
  17close TMP;
  18
  19printf '\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];
  27
  28for (@menu) {
  29        print "* ${_}::\n";
  30}
  31print "\@end menu\n";
  32open TMP, '<', "$output.tmp";
  33while (<TMP>) {
  34        print;
  35}
  36close TMP;
  37print "\@bye\n";
  38unlink "$output.tmp";