Front page | perl.perl5.porters |
Postings from April 2000
Re: [ID 20000405.021] Pod::Man bug
Thread Previous
From:
Todd C. Miller
Date:
April 23, 2000 19:31
Subject:
Re: [ID 20000405.021] Pod::Man bug
Message ID:
200004240231.e3O2Vgt26641@xerxes.courtesan.com
Looks good to me. Both C<-i> and C<I<FOO BAR>> act the way they ought.
- todd
In message <yl66t86y7p.fsf@windlord.stanford.edu>
so spake Russ Allbery (rra):
> Todd C Miller <Todd.Miller@courtesan.com> writes:
>
> > That has some other problems. For instance, compare the formatted
> > output of pod2man on perlfaq.pod before and after this patch. You end
> > up with an errant character at the end of some lines which results in
> > weird formatting glitches like the following:
>
> > - o How can I make `\w' match national character sets?
> > + o How can I make `744
>
> *grumble*
>
> Okay, this is good, actually. It made me take a close look at this and
> realize that I was doing these fixups in completely the wrong place. Try
> this patch against a virgin 5.6.0 Man.pm; I see no differences in the
> output when run against perlfaq.pod between this and the 1.01 version, and
> it should fix the bugs with hyphens. It also has the plus of not needing
> to call the children() method at all.
>
> --- Man.pm 2000/03/19 07:30:13 1.2
> +++ Man.pm 2000/04/24 02:13:40
> @@ -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.3 2000/04/09 09:23:54 eagle Exp $
> #
> # Copyright 1999, 2000 by Russ Allbery <rra@stanford.edu>
> #
> @@ -38,7 +38,7 @@
> # 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 @@
> 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 @@
> } 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 @@
> # 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 @@
> $$_;
> } else {
> s/\\/\\e/g;
> + s/-/\\-/g if $literal > 1;
> + s/__/_\\|_/g if $literal > 1;
> $_;
> }
> } $ptree->children);
>
> --
> Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Thread Previous