Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Pod-Simple CPAN distribution.

Report information
The Basics
Id: 65921
Status: rejected
Priority: 0/
Queue: Pod-Simple

People
Owner: Nobody in particular
Requestors: MSTEVENS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: attempt to add whitespace warning
Didn't get any response on pod-people, so submitting as bug: The attached patch tries to add the whitespace on empty line warning from Pod::Parser to Pod::Simple. I suspect this may need discussion, and may even be completely wrong!
Subject: 0001-Add-whitespace-on-empty-line-warning.patch
From f180a9bf6b05b5a94ba25430fb31436b4cc782f2 Mon Sep 17 00:00:00 2001 From: Michael Stevens <mstevens@etla.org> Date: Sat, 12 Feb 2011 21:21:54 +0000 Subject: [PATCH] Add whitespace on empty line warning. --- lib/Pod/Simple/BlackBox.pm | 4 ++++ t/corpus/fet_dup.txt | 4 ++-- t/corpus/koi8r.txt | 4 ++-- t/corpus/whitespace.txt | 9 +++++++++ t/corpus/whitespace.xml | 29 +++++++++++++++++++++++++++++ t/html01.t | 4 ++-- 6 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 t/corpus/whitespace.txt create mode 100644 t/corpus/whitespace.xml diff --git a/lib/Pod/Simple/BlackBox.pm b/lib/Pod/Simple/BlackBox.pm index d90ea79..aab3bbd 100644 --- a/lib/Pod/Simple/BlackBox.pm +++ b/lib/Pod/Simple/BlackBox.pm @@ -202,6 +202,10 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines) } $self->{'last_was_blank'} = 1; + + if ($line =~ m/^\s+$/s and @$paras and $paras->[-1][0] ne "~Verbatim") { + $self->whine($self->{'line_count'}, "line containing nothing but whitespace"); + } } elsif($self->{'last_was_blank'}) { # A non-blank line starting a new para... diff --git a/t/corpus/fet_dup.txt b/t/corpus/fet_dup.txt index e8552e7..6485594 100644 --- a/t/corpus/fet_dup.txt +++ b/t/corpus/fet_dup.txt @@ -16,12 +16,12 @@ This should generate no errata. çÄÅ ÓÅÒÄÃÁ Ú×ÕÞÎÙÊ ÐÙÌ ÓÉÑÎØÅ ÌØÅÔ ËÒÕÇÏÍ / é ÓÔÒÁÓÔÉ ÒÏËÏ×ÏÊ ×ÚÄÙÍÁÀÔÓÑ ÐÏÔÏËÉ,- / îÅ ×ÓÐÏÍÎÉÌÁ ÌØ Ï ÞÅÍ? - + ñ ×ÅÒÉÔØ ÎÅ ÈÏÞÕ! ëÏÇÄÁ × ÓÔÅÐÉ, ËÁË ÄÉ×Ï, / ÷ ÐÏÌÎÏÞÎÏÊ ÔÅÍÎÏÔÅ ÂÅÚ×ÒÅÍÅÎÎÏ ÇÏÒÑ, / ÷ÄÁÌÉ ÐÅÒÅÄ ÔÏÂÏÊ ÐÒÏÚÒÁÞÎÏ É ËÒÁÓÉ×Ï / ÷ÓÔÁ×ÁÌÁ ×ÄÒÕÇÚÁÒÑ. - + é × ÜÔÕ ËÒÁÓÏÔÕ ÎÅ×ÏÌØÎÏ ×ÚÏÒ ÔÑÎÕÌÏ, / ÷ ÔÏÔ ×ÅÌÉÞÁ×ÙÊ ÂÌÅÓË ÚÁ ÔÅÍÎÙÊ ×ÅÓØ ÐÒÅÄÅÌ,- / õÖÅÌØ ÎÉÞÔÏ ÔÅÂÅ × ÔÏ ×ÒÅÍÑ ÎÅ ÛÅÐÎÕÌÏ: / diff --git a/t/corpus/koi8r.txt b/t/corpus/koi8r.txt index c15d742..3ad4274 100644 --- a/t/corpus/koi8r.txt +++ b/t/corpus/koi8r.txt @@ -13,12 +13,12 @@ çÄÅ ÓÅÒÄÃÁ Ú×ÕÞÎÙÊ ÐÙÌ ÓÉÑÎØÅ ÌØÅÔ ËÒÕÇÏÍ / é ÓÔÒÁÓÔÉ ÒÏËÏ×ÏÊ ×ÚÄÙÍÁÀÔÓÑ ÐÏÔÏËÉ,- / îÅ ×ÓÐÏÍÎÉÌÁ ÌØ Ï ÞÅÍ? - + ñ ×ÅÒÉÔØ ÎÅ ÈÏÞÕ! ëÏÇÄÁ × ÓÔÅÐÉ, ËÁË ÄÉ×Ï, / ÷ ÐÏÌÎÏÞÎÏÊ ÔÅÍÎÏÔÅ ÂÅÚ×ÒÅÍÅÎÎÏ ÇÏÒÑ, / ÷ÄÁÌÉ ÐÅÒÅÄ ÔÏÂÏÊ ÐÒÏÚÒÁÞÎÏ É ËÒÁÓÉ×Ï / ÷ÓÔÁ×ÁÌÁ ×ÄÒÕÇÚÁÒÑ. - + é × ÜÔÕ ËÒÁÓÏÔÕ ÎÅ×ÏÌØÎÏ ×ÚÏÒ ÔÑÎÕÌÏ, / ÷ ÔÏÔ ×ÅÌÉÞÁ×ÙÊ ÂÌÅÓË ÚÁ ÔÅÍÎÙÊ ×ÅÓØ ÐÒÅÄÅÌ,- / õÖÅÌØ ÎÉÞÔÏ ÔÅÂÅ × ÔÏ ×ÒÅÍÑ ÎÅ ÛÅÐÎÕÌÏ: / diff --git a/t/corpus/whitespace.txt b/t/corpus/whitespace.txt new file mode 100644 index 0000000..5ef14c9 --- /dev/null +++ b/t/corpus/whitespace.txt @@ -0,0 +1,9 @@ +=pod + +=head1 FOO + +Some reasonably sensible pod. + +Shockingly, the previous line had whitespace. + +=cut diff --git a/t/corpus/whitespace.xml b/t/corpus/whitespace.xml new file mode 100644 index 0000000..d33579c --- /dev/null +++ b/t/corpus/whitespace.xml @@ -0,0 +1,29 @@ +<Document start_line="1"> + <head1 start_line="3"> + FOO + </head1> + <Para start_line="5"> + Some reasonably sensible pod. + </Para> + <Para start_line="7"> + Shockingly, the previous line had whitespace. + </Para> + <head1 errata="1" start_line="-321"> + POD ERRORS + </head1> + <Para errata="1" start_line="-321"> + Hey! + <B> + The above document had some coding errors, which are explained + below: + </B> + </Para> + <over-text errata="1" indent="4" start_line="-321"> + <item-text start_line="-321"> + Around line 6: + </item-text> + <Para start_line="-321"> + line containing nothing but whitespace + </Para> + </over-text> +</Document> diff --git a/t/html01.t b/t/html01.t index 5ad848e..a0f919b 100644 --- a/t/html01.t +++ b/t/html01.t @@ -25,9 +25,9 @@ sub x ($;&) { ok( x( q{ =pod - + This is a paragraph - + =cut }), qq{\n<p>This is a paragraph</p>\n}, -- 1.7.3.5
On Sat Feb 19 12:54:56 2011, MSTEVENS wrote: Show quoted text
> Didn't get any response on pod-people, so submitting as bug: > > The attached patch tries to add the whitespace on empty line warning > from Pod::Parser to Pod::Simple. > > I suspect this may need discussion, and may even be completely wrong!
I think your patch works. However, do you still feel like you need it? Pod::Checker tries to check for the same thing, and my concern is that adding this to plain Pod::Simple will cause a bunch of backward compatibility issues. If the checks in Pod::Checker are defective, we can fix it instead of Pod::Simple I'd like to see some discussion on this.
I tried the patch, and it causes test failures. Since the functionality is available in Pod::Checker, and this causes problems, and there was no discussion about it, I'm rejecting this ticket.