X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fcheckpods.PL;h=0cac62325e5778fbed02b64a28a289814774dbdf;hb=be44fb0e48bd19a864cf6b6d066beef8e960db7d;hp=4bec4da6095e3c61ffb3bfde851d2b95797de84f;hpb=774d564bb7dd1ed64ca0d7e534aa67e93f991f02;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/checkpods.PL b/pod/checkpods.PL index 4bec4da..0cac623 100644 --- a/pod/checkpods.PL +++ b/pod/checkpods.PL @@ -37,7 +37,7 @@ print OUT <<'!NO!SUBS!'; # From: Roderick Schertler # To: perl5-porters@africa.nicoh.com # Subject: POD lines with only spaces -# +# # There are some places in the documentation where a POD directive is # ignored because the line before it contains whitespace (and so the # directive doesn't start a paragraph). This patch adds a way to check @@ -53,16 +53,26 @@ print OUT <<'!NO!SUBS!'; # to grow. Someone will probably want to rewrite in terms of # some sort of Pod::Checker module. Or something. Consider this # a placeholder for the future. -$exit = $last_blank = 0; +# Version 1.02 Roderick Schertler +# Check for pod directives following any kind of unempty line, not +# just lines of whitespace. + +@directive = qw(head1 head2 item over back cut pod for begin end); +@directive{@directive} = (1) x @directive; + +$exit = $last_unempty = 0; while (<>) { - chop; - if (/^(=\S+)/ && $last_blank) { - printf "%s: line %5d, Non-empty line preceeding directive %s\n", + chomp; + if (/^=(\S+)/ && $directive{$1} && $last_unempty) { + printf "%s: line %5d, no blank line preceeding directive =%s\n", $ARGV, $., $1; $exit = 1; } - $last_blank = /^\s+$/; - close(ARGV) if eof; + $last_unempty = ($_ ne ''); + if (eof) { + close(ARGV); + $last_unempty = 0; + } } exit $exit !NO!SUBS!