Permalink
Browse files

import Pod-Parser 1.37 from CPAN

git-cpan-module:   Pod-Parser
git-cpan-version:  1.37
git-cpan-authorid: MAREKR
git-cpan-file:     authors/id/M/MA/MAREKR/Pod-Parser-1.37.tar.gz
  • Loading branch information...
1 parent a8e956d commit 9608a07adbc3265b6219b8204ad9d66db6d826b1 Marek Rouchal committed with schwern Feb 4, 2009
Showing with 175 additions and 107 deletions.
  1. +1 −1 ANNOUNCE
  2. +22 −0 CHANGES
  3. +4 −2 META.yml
  4. +4 −2 Makefile.PL
  5. +2 −2 lib/Pod/Checker.pm
  6. +21 −12 lib/Pod/Parser.pm
  7. +8 −7 lib/Pod/PlainText.pm
  8. +8 −1 t/pod/contains_pod.t
  9. +23 −16 t/pod/find.t
  10. +26 −8 t/pod/pod2usage2.t
  11. +56 −56 t/pod/usage2.pod
View
@@ -4,7 +4,7 @@
The Dead Parrot Sketch, Monty Python's Flying Circus
Do s/parrot/package/g and you know the status of this distribution.
-The current version 1.36 has been provided to fix a number of bugs
+The current version 1.37 has been provided to fix a number of bugs
and integrate a bunch of useful enhancements, which were provided as
patches, thanks to the contributers.
View
22 CHANGES
@@ -3,6 +3,28 @@ ATTENTION!
Before using this for any _new_ software, please consider using Pod::Simple,
it is a modern replacement for this module.
+ 04-Feb-2008 Marek Rouchal <marekr@cpan.org>
+ -----------------------------------------------------------------------------
+ Version 1.37
+ + fixed resource links in META.yml
+ + address CPAN#42695 with a minor change in PlainText, although not solving
+ it completely; the 'loose' option now applies to all =headN headings
+ + address failures of find.t on Win32 (cpantesters) - root cause was a
+ mismatch of directory names like "Progra~1" (short/long file names)
+ + include the following bleadperl changes:
+ * Blank lines "between" verbatim sections are now acceptible:
+ http://perl5.git.perl.org/perl.git/commitdiff/caa547d
+ * Be less picky about what constitutes "numeric lists" in Pod:
+ http://perl5.git.perl.org/perl.git/commitdiff/4df4f5d
+ * Changes made to contains_pod.t when upgrading to 1.34:
+ http://perl5.git.perl.org/perl.git/commitdiff/fb59f97
+ * Fix paths on new pod2usage2 tests to work in the core.
+ http://perl5.git.perl.org/perl.git/commitdiff/222046efb22c183703fea2b30db76296ab782e89
+ * Make t/pod/pod2usage2.t work on case insensitive file systems.
+ http://perl5.git.perl.org/perl.git/commitdiff/767c16ab361d1225fb153423fb22b590c1e0c7ea
+ Thanks to Nicholas Clark, Steve Hay, Jerry D. Hedden for the patches
+ + removed \r from t/pod/usage2.pod
+
19-Jan-2008 Marek Rouchal <marekr@cpan.org>
-----------------------------------------------------------------------------
View
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Pod-Parser
-version: 1.36
+version: 1.37
abstract: Modules for parsing/translating POD format documents
author:
- Brad Appleton <bradapp@enteract.com>
@@ -9,7 +9,9 @@ distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
requires:
- Test::More: 0.6
+ Cwd: 0
+ File::Basename: 0
+ Test::More: 0.6
no_index:
directory:
- t
View
@@ -61,7 +61,9 @@ push @testdirs, $test2dir if (-d $test2dir);
# needed for new pod2usage2.t
my %prereq = (
- 'Test::More' => 0.60
+ 'Test::More' => 0.60,
+ 'Cwd' => 0,
+ 'File::Basename' => 0
);
if ($] < 5.005) {
## Need File::Spec if this is 5.004 or earlier
@@ -71,7 +73,7 @@ if ($] < 5.005) {
WriteMakefile(
NAME => $DISTMOD,
DISTNAME => $DISTNAME,
- VERSION => '1.36',
+ VERSION => '1.37',
INSTALLDIRS => ($] >= 5.006 ? 'perl' : 'site'),
PL_FILES => { map { (script("$_.PL") => script($_)) } @SCRIPTS },
EXE_FILES => [ @EXE_FILES ],
View
@@ -11,7 +11,7 @@ package Pod::Checker;
use strict;
use vars qw($VERSION @ISA @EXPORT %VALID_COMMANDS %VALID_SEQUENCES);
-$VERSION = '1.44'; ## Current version of this package
+$VERSION = '1.45'; ## Current version of this package
require 5.005; ## requires this Perl version or later
use Pod::ParseUtils; ## for hyperlinks and lists
@@ -864,7 +864,7 @@ sub command {
$self->{_list_item_contents} = $1 ? 1 : 0;
$arg = $1;
}
- elsif($arg =~ /^\d+\.?\s*(\S*)/) {
+ elsif($arg =~ /^\d+\.?\s+(\S*)/) {
$type = 'number';
$self->{_list_item_contents} = $1 ? 1 : 0;
$arg = $1;
View
@@ -12,7 +12,7 @@ use strict;
## These "variables" are used as local "glob aliases" for performance
use vars qw($VERSION @ISA %myData %myOpts @input_stack);
-$VERSION = '1.36'; ## Current version of this package
+$VERSION = '1.37'; ## Current version of this package
require 5.005; ## requires this Perl version or later
#############################################################################
@@ -986,18 +986,38 @@ sub parse_paragraph {
# ## (invoke_callbacks will return true if we do).
# return 1 unless $self->invoke_callbacks($cmd, $text, $line_num, $pod_para);
# }
+
+ # If the last paragraph ended in whitespace, and we're not between verbatim blocks, carp
+ if ($myData{_WHITESPACE} and $myOpts{'-warnings'}
+ and not ($text =~ /^\s+/ and ($myData{_PREVIOUS}||"") eq "verbatim")) {
+ my $errorsub = $self->errorsub();
+ my $line = $line_num - 1;
+ my $errmsg = "*** WARNING: line containing nothing but whitespace".
+ " in paragraph at line $line in file $myData{_INFILE}\n";
+ (ref $errorsub) and &{$errorsub}($errmsg)
+ or (defined $errorsub) and $self->$errorsub($errmsg)
+ or carp($errmsg);
+ }
+
if (length $cmd) {
## A command paragraph
$self->command($cmd, $text, $line_num, $pod_para);
+ $myData{_PREVIOUS} = $cmd;
}
elsif ($text =~ /^\s+/) {
## Indented text - must be a verbatim paragraph
$self->verbatim($text, $line_num, $pod_para);
+ $myData{_PREVIOUS} = "verbatim";
}
else {
## Looks like an ordinary block of text
$self->textblock($text, $line_num, $pod_para);
+ $myData{_PREVIOUS} = "textblock";
}
+
+ # Update the whitespace for the next time around
+ $myData{_WHITESPACE} = $text =~ /^[^\S\r\n]+\Z/m ? 1 : 0;
+
return 1;
}
@@ -1079,17 +1099,6 @@ sub parse_from_filehandle {
next unless (($textline =~ /^([^\S\r\n]*)[\r\n]*$/)
&& (length $paragraph));
- ## Issue a warning about any non-empty blank lines
- if (length($1) > 0 and $myOpts{'-warnings'} and not $myData{_CUTTING}) {
- my $errorsub = $self->errorsub();
- my $file = $self->input_file();
- my $errmsg = '*** WARNING: line containing nothing but whitespace'.
- " in paragraph at line $nlines in file $file\n";
- (ref $errorsub) and &{$errorsub}($errmsg)
- or (defined $errorsub) and $self->$errorsub($errmsg)
- or carp($errmsg);
- }
-
## Now process the paragraph
parse_paragraph($self, $paragraph, ($nlines - $plines) + 1);
$paragraph = '';
View
@@ -29,7 +29,7 @@ use vars qw(@ISA %ESCAPES $VERSION);
# by Pod::Usage.
@ISA = qw(Pod::Select);
-$VERSION = '2.03';
+$VERSION = '2.04';
BEGIN {
if ($] < 5.006) {
@@ -312,6 +312,7 @@ sub cmd_head2 {
if ($$self{alt}) {
$self->output ("\n== $_ ==\n\n");
} else {
+ $_ .= "\n" if $$self{loose};
$self->output (' ' x ($$self{indent} / 2) . $_ . "\n");
}
}
@@ -325,6 +326,7 @@ sub cmd_head3 {
if ($$self{alt}) {
$self->output ("\n= $_ =\n");
} else {
+ $_ .= "\n" if $$self{loose};
$self->output (' ' x ($$self{indent}) . $_ . "\n");
}
}
@@ -643,12 +645,11 @@ C<=over> blocks. Defaults to 4.
=item loose
-If set to a true value, a blank line is printed after a C<=head1> heading.
-If set to false (the default), no blank line is printed after C<=head1>,
-although one is still printed after C<=head2>. This is the default because
-it's the expected formatting for manual pages; if you're formatting
-arbitrary text documents, setting this to true may result in more pleasing
-output.
+If set to a true value, a blank line is printed after a C<=headN> headings.
+If set to false (the default), no blank line is printed after C<=headN>.
+This is the default because it's the expected formatting for manual pages;
+if you're formatting arbitrary text documents, setting this to true may
+result in more pleasing output.
=item sentence
View
@@ -5,7 +5,14 @@
# $Id$
use strict;
-use lib qw( ./lib );
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = '../lib';
+ } else {
+ use lib qw( ./lib );
+ }
+}
use Test::More tests => 2;
View
@@ -14,19 +14,15 @@ BEGIN {
$| = 1;
-use Test;
+use Test::More tests => 4;
BEGIN {
- plan tests => 4;
- use File::Spec;
+ # 1. load successful
+ use_ok('Pod::Find', qw(pod_find pod_where));
}
-use Pod::Find qw(pod_find pod_where);
use File::Spec;
-# load successful
-ok(1);
-
require Cwd;
my $THISDIR = Cwd::cwd();
my $VERBOSE = $ENV{PERL_CORE} ? 0 : ($ENV{TEST_VERBOSE} || 0);
@@ -60,7 +56,7 @@ if ($^O eq 'VMS') {
$unix_mode = ($vms_efs && $vms_unix_rpt);
}
-print "### searching $lib_dir\n";
+print "### 2. searching $lib_dir\n";
my %pods = pod_find($lib_dir);
my $result = join(',', sort values %pods);
print "### found $result\n";
@@ -91,16 +87,16 @@ if ($^O eq 'VMS') {
foreach(@compare) {
$count += grep {/$_/} @result;
}
- ok($count/($#result+1)-1,$#compare);
+ is($count/($#result+1)-1,$#compare);
}
elsif (File::Spec->case_tolerant || $^O eq 'dos') {
- ok(lc $result,lc $compare);
+ is(lc $result,lc $compare);
}
else {
- ok($result,$compare);
+ is($result,$compare);
}
-print "### searching for File::Find\n";
+print "### 3. searching for File::Find\n";
$result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
|| 'undef - pod not found!';
print "### found $result\n";
@@ -114,18 +110,28 @@ if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
}
$result =~ s/perl_root:\[\-?\.?//i;
$result =~ s/\[\-?\.?//i; # needed under `mms test`
- ok($result,$compare);
+ is($result,$compare);
}
else {
$compare = $ENV{PERL_CORE} ?
File::Spec->catfile(File::Spec->updir, 'lib','File','Find.pm')
: File::Spec->catfile($Config::Config{privlibexp},"File","Find.pm");
- ok(_canon($result),_canon($compare));
+ my $resfile = _canon($result);
+ my $cmpfile = _canon($compare);
+ if($^O =~ /dos|win32/i && $resfile =~ /~\d(?=\\|$)/) {
+ # we have ~1 short filenames
+ $resfile = quotemeta($resfile);
+ $resfile =~ s/\\~\d(?=\\|$)/[^\\\\]+/g;
+ ok($cmpfile =~ /^$resfile$/, "pod_where found File::Find (with long filename matching)") ||
+ diag("'$cmpfile' does not match /^$resfile\$/");
+ } else {
+ is($resfile,$cmpfile,"pod_where found File::Find");
+ }
}
# Search for a documentation pod rather than a module
my $searchpod = 'Stuff';
-print "### searching for $searchpod.pod\n";
+print "### 4. searching for $searchpod.pod\n";
$result = pod_where(
{ -dirs => [ File::Spec->catdir(
$ENV{PERL_CORE} ? () : qw(t), 'pod', 'testpods', 'lib', 'Pod') ],
@@ -136,7 +142,8 @@ print "### found $result\n";
$compare = File::Spec->catfile(
$ENV{PERL_CORE} ? () : qw(t),
'pod', 'testpods', 'lib', 'Pod' ,'Stuff.pm');
-ok(_canon($result),_canon($compare));
+is(_canon($result),_canon($compare));
+
# make the path as generic as possible
sub _canon
Oops, something went wrong.

0 comments on commit 9608a07

Please sign in to comment.