mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
texi2pod.pl: Revert change from 2011-08-06.
This commit is contained in:
parent
6b5c0c742d
commit
3806fd1e02
@ -1,3 +1,7 @@
|
|||||||
|
2012-06-09 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* texi2pod.pl: Revert change from 2011-08-06.
|
||||||
|
|
||||||
2012-05-13 Giuseppe Scrivano <gscrivano@gnu.org>
|
2012-05-13 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
* wget.texi (Types of Files): Document --accept-regex and
|
* wget.texi (Types of Files): Document --accept-regex and
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/env perl
|
#! /usr/bin/env perl
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, 2001, 2003, 2010 Free Software Foundation, Inc.
|
# Copyright (C) 1999, 2000, 2001, 2003, 2007, 2009, 2010, 2011 Free
|
||||||
|
# Software Foundation, Inc.
|
||||||
|
|
||||||
# This file is part of GCC.
|
# This file is part of GCC.
|
||||||
|
|
||||||
@ -15,14 +16,15 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with GCC; see the file COPYING. If not, write to
|
# along with GCC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
||||||
# Boston MA 02110-1301, USA.
|
|
||||||
|
|
||||||
# This does trivial (and I mean _trivial_) conversion of Texinfo
|
# This does trivial (and I mean _trivial_) conversion of Texinfo
|
||||||
# markup to Perl POD format. It's intended to be used to extract
|
# markup to Perl POD format. It's intended to be used to extract
|
||||||
# something suitable for a manpage from a Texinfo document.
|
# something suitable for a manpage from a Texinfo document.
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
BEGIN { eval { require warnings; } and warnings->import; }
|
||||||
|
|
||||||
$output = 0;
|
$output = 0;
|
||||||
$skipping = 0;
|
$skipping = 0;
|
||||||
%sects = ();
|
%sects = ();
|
||||||
@ -36,7 +38,6 @@ $shift = "";
|
|||||||
$fnno = 1;
|
$fnno = 1;
|
||||||
$inf = "";
|
$inf = "";
|
||||||
$ibase = "";
|
$ibase = "";
|
||||||
@ipath = ();
|
|
||||||
|
|
||||||
while ($_ = shift) {
|
while ($_ = shift) {
|
||||||
if (/^-D(.*)$/) {
|
if (/^-D(.*)$/) {
|
||||||
@ -52,13 +53,6 @@ while ($_ = shift) {
|
|||||||
die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
|
die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
|
||||||
unless $flag =~ /^[a-zA-Z0-9_-]+$/;
|
unless $flag =~ /^[a-zA-Z0-9_-]+$/;
|
||||||
$defs{$flag} = $value;
|
$defs{$flag} = $value;
|
||||||
} elsif (/^-I(.*)$/) {
|
|
||||||
if ($1 ne "") {
|
|
||||||
$flag = $1;
|
|
||||||
} else {
|
|
||||||
$flag = shift;
|
|
||||||
}
|
|
||||||
push (@ipath, $flag);
|
|
||||||
} elsif (/^-/) {
|
} elsif (/^-/) {
|
||||||
usage();
|
usage();
|
||||||
} else {
|
} else {
|
||||||
@ -162,8 +156,6 @@ while(<$inf>) {
|
|||||||
} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
|
} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
|
||||||
$_ = "\n=back\n";
|
$_ = "\n=back\n";
|
||||||
$ic = pop @icstack;
|
$ic = pop @icstack;
|
||||||
} elsif ($ended eq "multitable") {
|
|
||||||
$_ = "\n=back\n";
|
|
||||||
} else {
|
} else {
|
||||||
die "unknown command \@end $ended at line $.\n";
|
die "unknown command \@end $ended at line $.\n";
|
||||||
}
|
}
|
||||||
@ -213,18 +205,14 @@ while(<$inf>) {
|
|||||||
|
|
||||||
# Now the ones that have to be replaced by special escapes
|
# Now the ones that have to be replaced by special escapes
|
||||||
# (which will be turned back into text by unmunge())
|
# (which will be turned back into text by unmunge())
|
||||||
# Replace @@ before @{ and @} in order to parse @samp{@@} correctly.
|
|
||||||
s/&/&/g;
|
s/&/&/g;
|
||||||
s/\@\@/&at;/g;
|
s/\@\@/&at;/g;
|
||||||
s/\@\{/{/g;
|
s/\@\{/{/g;
|
||||||
s/\@\}/}/g;
|
s/\@\}/}/g;
|
||||||
s/\@`\{(.)\}/&$1grave;/g;
|
|
||||||
|
|
||||||
# Inside a verbatim block, handle @var, @samp and @url specially.
|
# Inside a verbatim block, handle @var specially.
|
||||||
if ($shift ne "") {
|
if ($shift ne "") {
|
||||||
s/\@var\{([^\}]*)\}/<$1>/g;
|
s/\@var\{([^\}]*)\}/<$1>/g;
|
||||||
s/\@samp\{([^\}]*)\}/"$1"/g;
|
|
||||||
s/\@url\{([^\}]*)\}/<$1>/g;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# POD doesn't interpret E<> inside a verbatim block.
|
# POD doesn't interpret E<> inside a verbatim block.
|
||||||
@ -243,23 +231,17 @@ while(<$inf>) {
|
|||||||
$inf = gensym();
|
$inf = gensym();
|
||||||
$file = postprocess($1);
|
$file = postprocess($1);
|
||||||
|
|
||||||
# Try cwd and $ibase, then explicit -I paths.
|
# Try cwd and $ibase.
|
||||||
$done = 0;
|
open($inf, "<" . $file)
|
||||||
foreach $path ("", $ibase, @ipath) {
|
or open($inf, "<" . $ibase . "/" . $file)
|
||||||
$mypath = $file;
|
or die "cannot open $file or $ibase/$file: $!\n";
|
||||||
$mypath = $path . "/" . $mypath if ($path ne "");
|
|
||||||
open($inf, "<" . $mypath) and ($done = 1, last);
|
|
||||||
}
|
|
||||||
die "cannot find $file" if !$done;
|
|
||||||
next;
|
next;
|
||||||
};
|
};
|
||||||
|
|
||||||
/^\@(?:section|unnumbered|unnumberedsec|center|heading)\s+(.+)$/
|
/^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
|
||||||
and $_ = "\n=head2 $1\n";
|
and $_ = "\n=head2 $1\n";
|
||||||
/^\@subsection\s+(.+)$/
|
/^\@subsection\s+(.+)$/
|
||||||
and $_ = "\n=head3 $1\n";
|
and $_ = "\n=head3 $1\n";
|
||||||
/^\@subsubsection\s+(.+)$/
|
|
||||||
and $_ = "\n=head4 $1\n";
|
|
||||||
|
|
||||||
# Block command handlers:
|
# Block command handlers:
|
||||||
/^\@itemize(?:\s+(\@[a-z]+|\*|-))?/ and do {
|
/^\@itemize(?:\s+(\@[a-z]+|\*|-))?/ and do {
|
||||||
@ -268,7 +250,7 @@ while(<$inf>) {
|
|||||||
if (defined $1) {
|
if (defined $1) {
|
||||||
$ic = $1;
|
$ic = $1;
|
||||||
} else {
|
} else {
|
||||||
$ic = '*';
|
$ic = '@bullet';
|
||||||
}
|
}
|
||||||
$_ = "\n=over 4\n";
|
$_ = "\n=over 4\n";
|
||||||
$endw = "itemize";
|
$endw = "itemize";
|
||||||
@ -286,12 +268,6 @@ while(<$inf>) {
|
|||||||
$endw = "enumerate";
|
$endw = "enumerate";
|
||||||
};
|
};
|
||||||
|
|
||||||
/^\@multitable\s.*/ and do {
|
|
||||||
push @endwstack, $endw;
|
|
||||||
$endw = "multitable";
|
|
||||||
$_ = "\n=over 4\n";
|
|
||||||
};
|
|
||||||
|
|
||||||
/^\@([fv]?table)\s+(\@[a-z]+)/ and do {
|
/^\@([fv]?table)\s+(\@[a-z]+)/ and do {
|
||||||
push @endwstack, $endw;
|
push @endwstack, $endw;
|
||||||
push @icstack, $ic;
|
push @icstack, $ic;
|
||||||
@ -301,7 +277,6 @@ while(<$inf>) {
|
|||||||
$ic =~ s/\@(?:code|kbd)/C/;
|
$ic =~ s/\@(?:code|kbd)/C/;
|
||||||
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
|
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
|
||||||
$ic =~ s/\@(?:file)/F/;
|
$ic =~ s/\@(?:file)/F/;
|
||||||
$ic =~ s/\@(?:asis)//;
|
|
||||||
$_ = "\n=over 4\n";
|
$_ = "\n=over 4\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -312,29 +287,14 @@ while(<$inf>) {
|
|||||||
$_ = ""; # need a paragraph break
|
$_ = ""; # need a paragraph break
|
||||||
};
|
};
|
||||||
|
|
||||||
/^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
|
|
||||||
@columns = ();
|
|
||||||
for $column (split (/\s*\@tab\s*/, $1)) {
|
|
||||||
# @strong{...} is used a @headitem work-alike
|
|
||||||
$column =~ s/^\@strong{(.*)}$/$1/;
|
|
||||||
push @columns, $column;
|
|
||||||
}
|
|
||||||
$_ = "\n=item ".join (" : ", @columns)."\n";
|
|
||||||
};
|
|
||||||
|
|
||||||
/^\@itemx?\s*(.+)?$/ and do {
|
/^\@itemx?\s*(.+)?$/ and do {
|
||||||
if (defined $1) {
|
if (defined $1) {
|
||||||
if ($ic) {
|
my $thing = $1;
|
||||||
if ($endw eq "enumerate") {
|
if ($ic =~ /\@asis/) {
|
||||||
$_ = "\n=item $ic $1\n";
|
$_ = "\n=item $thing\n";
|
||||||
$ic =~ s/(\d+)/$1 + 1/eg;
|
|
||||||
} else {
|
|
||||||
# Entity escapes prevent munging by the <>
|
|
||||||
# processing below.
|
|
||||||
$_ = "\n=item $ic\<$1\>\n";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$_ = "\n=item $1\n";
|
# Entity escapes prevent munging by the <> processing below.
|
||||||
|
$_ = "\n=item $ic\<$thing\>\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$_ = "\n=item $ic\n";
|
$_ = "\n=item $ic\n";
|
||||||
@ -355,11 +315,12 @@ die "No filename or title\n" unless defined $fn && defined $tl;
|
|||||||
$sects{NAME} = "$fn \- $tl\n";
|
$sects{NAME} = "$fn \- $tl\n";
|
||||||
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
|
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
|
||||||
|
|
||||||
for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT FILES
|
for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT EXITSTATUS
|
||||||
BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
|
FILES BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
|
||||||
if(exists $sects{$sect}) {
|
if(exists $sects{$sect}) {
|
||||||
$head = $sect;
|
$head = $sect;
|
||||||
$head =~ s/SEEALSO/SEE ALSO/;
|
$head =~ s/SEEALSO/SEE ALSO/;
|
||||||
|
$head =~ s/EXITSTATUS/EXIT STATUS/;
|
||||||
print "=head1 $head\n\n";
|
print "=head1 $head\n\n";
|
||||||
print scalar unmunge ($sects{$sect});
|
print scalar unmunge ($sects{$sect});
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -391,13 +352,11 @@ sub postprocess
|
|||||||
s/\@r\{([^\}]*)\}/R<$1>/g;
|
s/\@r\{([^\}]*)\}/R<$1>/g;
|
||||||
s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
|
s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
|
||||||
s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
|
s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
|
||||||
s/\@(?:samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
|
s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
|
||||||
s/\@sc\{([^\}]*)\}/\U$1/g;
|
s/\@sc\{([^\}]*)\}/\U$1/g;
|
||||||
s/\@acronym\{([^\}]*)\}/\U$1/g;
|
|
||||||
s/\@file\{([^\}]*)\}/F<$1>/g;
|
s/\@file\{([^\}]*)\}/F<$1>/g;
|
||||||
s/\@w\{([^\}]*)\}/S<$1>/g;
|
s/\@w\{([^\}]*)\}/S<$1>/g;
|
||||||
s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
|
s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
|
||||||
s/\@\///g;
|
|
||||||
|
|
||||||
# keep references of the form @ref{...}, print them bold
|
# keep references of the form @ref{...}, print them bold
|
||||||
s/\@(?:ref)\{([^\}]*)\}/B<$1>/g;
|
s/\@(?:ref)\{([^\}]*)\}/B<$1>/g;
|
||||||
@ -419,9 +378,6 @@ sub postprocess
|
|||||||
s/\@gol//g;
|
s/\@gol//g;
|
||||||
s/\@\*\s*\n?//g;
|
s/\@\*\s*\n?//g;
|
||||||
|
|
||||||
# Anchors are thrown away
|
|
||||||
s/\@anchor\{(?:[^\}]*)\}//g;
|
|
||||||
|
|
||||||
# @uref can take one, two, or three arguments, with different
|
# @uref can take one, two, or three arguments, with different
|
||||||
# semantics each time. @url and @email are just like @uref with
|
# semantics each time. @url and @email are just like @uref with
|
||||||
# one argument, for our purposes.
|
# one argument, for our purposes.
|
||||||
@ -429,10 +385,6 @@ sub postprocess
|
|||||||
s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
|
s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
|
||||||
s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
|
s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
|
||||||
|
|
||||||
# Handle gccoptlist here, so it can contain the above formatting
|
|
||||||
# commands.
|
|
||||||
s/\@gccoptlist\{([^\}]*)\}/B<$1>/g;
|
|
||||||
|
|
||||||
# Un-escape <> at this point.
|
# Un-escape <> at this point.
|
||||||
s/</</g;
|
s/</</g;
|
||||||
s/>/>/g;
|
s/>/>/g;
|
||||||
@ -466,7 +418,6 @@ sub unmunge
|
|||||||
# Replace escaped symbols with their equivalents.
|
# Replace escaped symbols with their equivalents.
|
||||||
local $_ = $_[0];
|
local $_ = $_[0];
|
||||||
|
|
||||||
s/&(.)grave;/E<$1grave>/g;
|
|
||||||
s/</E<lt>/g;
|
s/</E<lt>/g;
|
||||||
s/>/E<gt>/g;
|
s/>/E<gt>/g;
|
||||||
s/{/\{/g;
|
s/{/\{/g;
|
||||||
|
Loading…
Reference in New Issue
Block a user