brintos

brintos / linux-shallow public Read only

0
0
Text · 805 B · 14d2f83 Raw
47 lines · plain
1#!/usr/bin/perl -w2 3use strict;4use warnings;5 6my @menu = ();7my $output = $ARGV[0];8 9open my $tmp, '>', "$output.tmp";10 11while (<STDIN>) {12	next if (/^\\input texinfo/../\@node Top/);13	next if (/^\@bye/ || /^\.ft/);14	if (s/^\@top (.*)/\@node $1,,,Top/) {15		push @menu, $1;16	}17	s/\(\@pxref\{\[(URLS|REMOTES)\]}\)//;18	s/\@anchor\{[^{}]*\}//g;19	print $tmp $_;20}21close $tmp;22 23print '\input texinfo24@setfilename gitman.info25@documentencoding UTF-826@dircategory Development27@direntry28* Git Man Pages: (gitman).  Manual pages for Git revision control system29@end direntry30@node Top,,, (dir)31@top Git Manual Pages32@documentlanguage en33@menu34';35 36for (@menu) {37	print "* ${_}::\n";38}39print "\@end menu\n";40open $tmp, '<', "$output.tmp";41while (<$tmp>) {42	print;43}44close $tmp;45print "\@bye\n";46unlink "$output.tmp";47