1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w 2 2 3 use strict; 3 use strict; 4 use warnings; 4 use warnings; 5 5 6 my @menu = (); 6 my @menu = (); 7 my $output = $ARGV[0]; 7 my $output = $ARGV[0]; 8 8 9 open my $tmp, '>', "$output.tmp"; 9 open my $tmp, '>', "$output.tmp"; 10 10 11 while (<STDIN>) { 11 while (<STDIN>) { 12 next if (/^\\input texinfo/../\@node T 12 next if (/^\\input texinfo/../\@node Top/); 13 next if (/^\@bye/ || /^\.ft/); 13 next if (/^\@bye/ || /^\.ft/); 14 if (s/^\@top (.*)/\@node $1,,,Top/) { 14 if (s/^\@top (.*)/\@node $1,,,Top/) { 15 push @menu, $1; 15 push @menu, $1; 16 } 16 } 17 s/\(\@pxref\{\[(URLS|REMOTES)\]}\)//; 17 s/\(\@pxref\{\[(URLS|REMOTES)\]}\)//; 18 s/\@anchor\{[^{}]*\}//g; 18 s/\@anchor\{[^{}]*\}//g; 19 print $tmp $_; 19 print $tmp $_; 20 } 20 } 21 close $tmp; 21 close $tmp; 22 22 23 print '\input texinfo 23 print '\input texinfo 24 @setfilename gitman.info 24 @setfilename gitman.info 25 @documentencoding UTF-8 25 @documentencoding UTF-8 26 @dircategory Development 26 @dircategory Development 27 @direntry 27 @direntry 28 * Git Man Pages: (gitman). Manual pages for G 28 * Git Man Pages: (gitman). Manual pages for Git revision control system 29 @end direntry 29 @end direntry 30 @node Top,,, (dir) 30 @node Top,,, (dir) 31 @top Git Manual Pages 31 @top Git Manual Pages 32 @documentlanguage en 32 @documentlanguage en 33 @menu 33 @menu 34 '; 34 '; 35 35 36 for (@menu) { 36 for (@menu) { 37 print "* ${_}::\n"; 37 print "* ${_}::\n"; 38 } 38 } 39 print "\@end menu\n"; 39 print "\@end menu\n"; 40 open $tmp, '<', "$output.tmp"; 40 open $tmp, '<', "$output.tmp"; 41 while (<$tmp>) { 41 while (<$tmp>) { 42 print; 42 print; 43 } 43 } 44 close $tmp; 44 close $tmp; 45 print "\@bye\n"; 45 print "\@bye\n"; 46 unlink "$output.tmp"; 46 unlink "$output.tmp";
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.