From: Gurusamy Sarathy Date: Mon, 1 May 2000 06:31:36 +0000 (+0000) Subject: podlators-1.02 update (from Russ Allbery) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a3e04946c25c4b5cb5639581935028fe456b8605;p=p5sagit%2Fp5-mst-13.2.git podlators-1.02 update (from Russ Allbery) p4raw-id: //depot/perl@6027 --- diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm index 97a3828..9ac4efe 100644 --- a/lib/Pod/Man.pm +++ b/lib/Pod/Man.pm @@ -1,5 +1,5 @@ # Pod::Man -- Convert POD data to formatted *roff input. -# $Id: Man.pm,v 1.2 2000/03/19 07:30:13 eagle Exp $ +# $Id: Man.pm,v 1.4 2000/04/26 04:03:41 eagle Exp $ # # Copyright 1999, 2000 by Russ Allbery # @@ -38,7 +38,7 @@ use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION); # Perl core and too many things could munge CVS magic revision strings. # This number should ideally be the same as the CVS revision in podlators, # however. -$VERSION = 1.02; +$VERSION = 1.04; ############################################################################ @@ -550,8 +550,11 @@ sub sequence { return bless \ "$tmp", 'Pod::Man::String'; } - # C<>, L<>, X<>, and E<> don't apply guesswork to their contents. - local $_ = $self->collapse ($seq->parse_tree, $command =~ /^[CELX]$/); + # C<>, L<>, X<>, and E<> don't apply guesswork to their contents. C<> + # needs some additional special handling. + my $literal = ($command =~ /^[CELX]$/); + $literal++ if $command eq 'C'; + local $_ = $self->collapse ($seq->parse_tree, $literal); # Handle E<> escapes. if ($command eq 'E') { @@ -576,8 +579,6 @@ sub sequence { } elsif ($command eq 'I') { return bless \ ('\f(IS' . $_ . '\f(IE'), 'Pod::Man::String'; } elsif ($command eq 'C') { - s/-/\\-/g; - s/__/_\\|_/g; return bless \ ('\f(FS\*(C`' . $_ . "\\*(C'\\f(FE"), 'Pod::Man::String'; } @@ -830,8 +831,10 @@ sub parse { # text (not call guesswork on it), and returns the concatenation of all of # the text strings in that parse tree. If the literal flag isn't true, # guesswork() will be called on all plain scalars in the parse tree. -# Assumes that everything in the parse tree is either a scalar or a -# reference to a scalar. +# Otherwise, just escape backslashes in the normal case. If collapse is +# being called on a C<> sequence, literal is set to 2, and we do some +# additional cleanup. Assumes that everything in the parse tree is either a +# scalar or a reference to a scalar. sub collapse { my ($self, $ptree, $literal) = @_; if ($literal) { @@ -840,6 +843,8 @@ sub collapse { $$_; } else { s/\\/\\e/g; + s/-/\\-/g if $literal > 1; + s/__/_\\|_/g if $literal > 1; $_; } } $ptree->children); diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm index d93e5a4..f5c1e3d 100644 --- a/lib/Pod/Text.pm +++ b/lib/Pod/Text.pm @@ -1,7 +1,7 @@ # Pod::Text -- Convert POD data to formatted ASCII text. -# $Id: Text.pm,v 2.3 1999/10/07 09:41:57 eagle Exp $ +# $Id: Text.pm,v 2.4 2000/03/17 00:17:08 eagle Exp $ # -# Copyright 1999 by Russ Allbery +# Copyright 1999, 2000 by Russ Allbery # # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. @@ -33,7 +33,11 @@ use vars qw(@ISA @EXPORT %ESCAPES $VERSION); # We have to export pod2text for backward compatibility. @EXPORT = qw(pod2text); -($VERSION = (split (' ', q$Revision: 2.3 $ ))[1]) =~ s/\.(\d)$/.0$1/; +# Don't use the CVS revision as the version, since this module is also in +# Perl core and too many things could munge CVS magic revision strings. +# This number should ideally be the same as the CVS revision in podlators, +# however. +$VERSION = 2.04; ############################################################################ @@ -43,7 +47,7 @@ use vars qw(@ISA @EXPORT %ESCAPES $VERSION); # This table is taken near verbatim from Pod::PlainText in Pod::Parser, # which got it near verbatim from the original Pod::Text. It is therefore # credited to Tom Christiansen, and I'm glad I didn't have to write it. :) -# "iexcl" to "divide" added by Tim Jenness +# "iexcl" to "divide" added by Tim Jenness. %ESCAPES = ( 'amp' => '&', # ampersand 'lt' => '<', # left chevron, less-than @@ -113,42 +117,42 @@ use vars qw(@ISA @EXPORT %ESCAPES $VERSION); "yacute" => "\xFD", # small y, acute accent "yuml" => "\xFF", # small y, dieresis or umlaut mark - "lchevron" => "\xAB", # left chevron (double less than) laquo - "rchevron" => "\xBB", # right chevron (double greater than) raquo - - "iexcl" => "\xA1", # inverted exclamation mark - "cent" => "\xA2", # cent sign - "pound" => "\xA3", # (UK) pound sign - "curren" => "\xA4", # currency sign - "yen" => "\xA5", # yen sign - "brvbar" => "\xA6", # broken vertical bar - "sect" => "\xA7", # section sign - "uml" => "\xA8", # diaresis - "copy" => "\xA9", # Copyright symbol - "ordf" => "\xAA", # feminine ordinal indicator - "laquo" => "\xAB", # left pointing double angle quotation mark - "not" => "\xAC", # not sign - "shy" => "\xAD", # soft hyphen - "reg" => "\xAE", # registered trademark - "macr" => "\xAF", # macron, overline - "deg" => "\xB0", # degree sign - "plusmn" => "\xB1", # plus-minus sign - "sup2" => "\xB2", # superscript 2 - "sup3" => "\xB3", # superscript 3 - "acute" => "\xB4", # acute accent - "micro" => "\xB5", # micro sign - "para" => "\xB6", # pilcrow sign = paragraph sign - "middot" => "\xB7", # middle dot = Georgian comma - "cedil" => "\xB8", # cedilla - "sup1" => "\xB9", # superscript 1 - "ordm" => "\xBA", # masculine ordinal indicator - "raquo" => "\xBB", # right pointing double angle quotation mark - "frac14" => "\xBC", # vulgar fraction one quarter - "frac12" => "\xBD", # vulgar fraction one half - "frac34" => "\xBE", # vulgar fraction three quarters - "iquest" => "\xBF", # inverted question mark - "times" => "\xD7", # multiplication sign - "divide" => "\xF7", # division sign + "laquo" => "\xAB", # left pointing double angle quotation mark + "lchevron" => "\xAB", # synonym (backwards compatibility) + "raquo" => "\xBB", # right pointing double angle quotation mark + "rchevron" => "\xBB", # synonym (backwards compatibility) + + "iexcl" => "\xA1", # inverted exclamation mark + "cent" => "\xA2", # cent sign + "pound" => "\xA3", # (UK) pound sign + "curren" => "\xA4", # currency sign + "yen" => "\xA5", # yen sign + "brvbar" => "\xA6", # broken vertical bar + "sect" => "\xA7", # section sign + "uml" => "\xA8", # diaresis + "copy" => "\xA9", # Copyright symbol + "ordf" => "\xAA", # feminine ordinal indicator + "not" => "\xAC", # not sign + "shy" => "\xAD", # soft hyphen + "reg" => "\xAE", # registered trademark + "macr" => "\xAF", # macron, overline + "deg" => "\xB0", # degree sign + "plusmn" => "\xB1", # plus-minus sign + "sup2" => "\xB2", # superscript 2 + "sup3" => "\xB3", # superscript 3 + "acute" => "\xB4", # acute accent + "micro" => "\xB5", # micro sign + "para" => "\xB6", # pilcrow sign = paragraph sign + "middot" => "\xB7", # middle dot = Georgian comma + "cedil" => "\xB8", # cedilla + "sup1" => "\xB9", # superscript 1 + "ordm" => "\xBA", # masculine ordinal indicator + "frac14" => "\xBC", # vulgar fraction one quarter + "frac12" => "\xBD", # vulgar fraction one half + "frac34" => "\xBE", # vulgar fraction three quarters + "iquest" => "\xBF", # inverted question mark + "times" => "\xD7", # multiplication sign + "divide" => "\xF7", # division sign );