X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=doc%2Ftexi2pod.pl;h=86c4b189ced76f1d27023cb1ec6fb056ae41ebfc;hp=0b57d1b99807536253fa95ab6df3e0fcc8162678;hb=2f6aa1d7417df1dfc58597777686fbd77179b9fd;hpb=4d7c5e087b2bc82c9f503dff003916d1047903ce diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 0b57d1b9..86c4b189 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -1,6 +1,7 @@ #! /usr/bin/env perl -# Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2003, 2007, 2009, 2010, 2011 Free +# Software Foundation, Inc. # This file is part of GCC. @@ -22,6 +23,7 @@ # something suitable for a manpage from a Texinfo document. use warnings; +BEGIN { eval { require warnings; } and warnings->import; } $output = 0; $skipping = 0; @@ -227,11 +229,12 @@ while(<$inf>) { /^\@include\s+(.+)$/ and do { push @instack, $inf; $inf = gensym(); + $file = postprocess($1); # Try cwd and $ibase. - open($inf, "<" . $1) - or open($inf, "<" . $ibase . "/" . $1) - or die "cannot open $1 or $ibase/$1: $!\n"; + open($inf, "<" . $file) + or open($inf, "<" . $ibase . "/" . $file) + or die "cannot open $file or $ibase/$file: $!\n"; next; }; @@ -274,7 +277,6 @@ while(<$inf>) { $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; - $ic =~ s/\@(?:asis)/S/; # punt $_ = "\n=over 4\n"; }; @@ -287,8 +289,13 @@ while(<$inf>) { /^\@itemx?\s*(.+)?$/ and do { if (defined $1) { - # Entity escapes prevent munging by the <> processing below. - $_ = "\n=item $ic\<$1\>\n"; + my $thing = $1; + if ($ic =~ /\@asis/) { + $_ = "\n=item $thing\n"; + } else { + # Entity escapes prevent munging by the <> processing below. + $_ = "\n=item $ic\<$thing\>\n"; + } } else { $_ = "\n=item $ic\n"; $ic =~ y/A-Ya-y/B-Zb-z/; @@ -308,11 +315,12 @@ die "No filename or title\n" unless defined $fn && defined $tl; $sects{NAME} = "$fn \- $tl\n"; $sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; -for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT EXAMPLES FILES - BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) { +for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT EXITSTATUS + FILES BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) { if(exists $sects{$sect}) { $head = $sect; $head =~ s/SEEALSO/SEE ALSO/; + $head =~ s/EXITSTATUS/EXIT STATUS/; print "=head1 $head\n\n"; print scalar unmunge ($sects{$sect}); print "\n"; @@ -350,6 +358,13 @@ sub postprocess s/\@w\{([^\}]*)\}/S<$1>/g; s/\@(?:dmn|math)\{([^\}]*)\}/$1/g; + # keep references of the form @ref{...}, print them bold + s/\@(?:ref)\{([^\}]*)\}/B<$1>/g; + + # Change double single quotes to double quotes. + s/''/"/g; + s/``/"/g; + # Cross references are thrown away, as are @noindent and @refill. # (@noindent is impossible in .pod, and @refill is unnecessary.) # @* is also impossible in .pod; we discard it and any newline that