This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove all mention of checkpods
[perl5.git] / lib / Pod / PlainText.pm
index 5d44adc..ec56608 100644 (file)
@@ -1,7 +1,7 @@
 # Pod::PlainText -- Convert POD data to formatted ASCII text.
 # $Id: Text.pm,v 2.1 1999/09/20 11:53:33 eagle Exp $
 #
-# Copyright 1999 by Russ Allbery <rra@stanford.edu>
+# Copyright 1999-2000 by Russ Allbery <rra@stanford.edu>
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the same terms as Perl itself.
@@ -17,7 +17,7 @@
 
 package Pod::PlainText;
 
-require 5.004;
+require 5.005;
 
 use Carp qw(carp croak);
 use Pod::Select ();
@@ -29,7 +29,7 @@ use vars qw(@ISA %ESCAPES $VERSION);
 # by Pod::Usage.
 @ISA = qw(Pod::Select);
 
-($VERSION = (split (' ', q$Revision: 2.1 $ ))[1]) =~ s/\.(\d)$/.0$1/;
+$VERSION = '2.02';
 
 
 ############################################################################
@@ -44,7 +44,7 @@ use vars qw(@ISA %ESCAPES $VERSION);
     'lt'        =>    '<',      # left chevron, less-than
     'gt'        =>    '>',      # right chevron, greater-than
     'quot'      =>    '"',      # double quote
-                                 
+
     "Aacute"    =>    "\xC1",   # capital A, acute accent
     "aacute"    =>    "\xE1",   # small a, acute accent
     "Acirc"     =>    "\xC2",   # capital A, circumflex accent
@@ -107,7 +107,7 @@ use vars qw(@ISA %ESCAPES $VERSION);
     "Yacute"    =>    "\xDD",   # capital Y, acute accent
     "yacute"    =>    "\xFD",   # small y, acute accent
     "yuml"      =>    "\xFF",   # small y, dieresis or umlaut mark
-                                  
+
     "lchevron"  =>    "\xAB",   # left chevron (double less than)
     "rchevron"  =>    "\xBB",   # right chevron (double greater than)
 );
@@ -303,6 +303,23 @@ sub cmd_head2 {
     }
 }
 
+# third level heading - not strictly perlpodspec compliant
+sub cmd_head3 {
+    my $self = shift;
+    local $_ = shift;
+    s/\s+$//;
+    $_ = $self->interpolate ($_, shift);
+    if ($$self{alt}) {
+        $self->output ("\n= $_ =\n");
+    } else {
+        $self->output (' ' x ($$self{indent}) . $_ . "\n");
+    }
+}
+
+# fourth level heading - not strictly perlpodspec compliant
+# just like head3
+*cmd_head4 = \&cmd_head3;
+
 # Start a list.
 sub cmd_over {
     my $self = shift;
@@ -396,7 +413,10 @@ sub seq_l {
     # something looking like L<manpage(section)>.  The latter is an
     # enhancement over the original Pod::Text.
     my ($manpage, $section) = ('', $_);
-    if (/^"\s*(.*?)\s*"$/) {
+    if (/^(?:https?|ftp|news):/) {
+        # a URL
+        return $_;
+    } elsif (/^"\s*(.*?)\s*"$/) {
         $section = '"' . $1 . '"';
     } elsif (m/^[-:.\w]+(?:\(\S+\))?$/) {
         ($manpage, $section) = ($_, '');
@@ -404,8 +424,8 @@ sub seq_l {
         ($manpage, $section) = split (/\s*\/\s*/, $_, 2);
     }
 
-    # Now build the actual output text.
     my $text = '';
+    # Now build the actual output text.
     if (!length $section) {
         $text = "the $manpage manpage" if length $manpage;
     } elsif ($section =~ /^[:\w]+(?:\(\))?/) {
@@ -692,6 +712,8 @@ pod2text(1)
 
 =head1 AUTHOR
 
+Please report bugs using L<http://rt.cpan.org>.
+
 Russ Allbery E<lt>rra@stanford.eduE<gt>, based I<very> heavily on the
 original Pod::Text by Tom Christiansen E<lt>tchrist@mox.perl.comE<gt> and
 its conversion to Pod::Parser by Brad Appleton