develooper Front page | perl.perl5.porters | Postings from January 2001

[PATCH] pod2man problem with line breaks in =headn

Thread Next
From:
Robin Barker
Date:
January 5, 2001 11:05
Subject:
[PATCH] pod2man problem with line breaks in =headn
Message ID:
200101051905.TAA03342@tempest.npl.co.uk
Hi

I found this problem when pod2man is applied to =headn command with text 
split over two lines.

% ( echo "=head1 A heading"; echo "on two lines"; echo; echo "then some text")
  | ./perl -Ilib pod/pod2man | nroff -man



	2001-01-05                                      <STANDARD(INPUT>)



	A heading
	     on two lines" on two lines" then some text



(Note also the funny arrangement of <> and () in "<STANDARD(INPUT>)" !? )

The patch below fixes the =headn problem in the same was as =item;
but I don't know if this is best.

With my patch 

% ( echo "=head1 A heading"; echo "on two lines"; echo; echo "then some text" ) 
  | ./perl -Ilib pod/pod2man | nroff -man



	2001-01-05                                      <STANDARD(INPUT>)



	A heading on two lines
	     then some text


Robin

--- lib/Pod/Man.pm.orig	Fri Dec 29 18:25:57 2000
+++ lib/Pod/Man.pm	Fri Jan  5 18:52:50 2001
@@ -629,6 +629,7 @@
     my $self = shift;
     local $_ = $self->parse (@_);
     s/\s+$//;
+    s/\s*\n\s*/ /g;
     s/\\s-?\d//g;
     if ($$self{ITEMS} > 1) {
         $$self{ITEMS} = 0;
@@ -644,6 +645,7 @@
     my $self = shift;
     local $_ = $self->parse (@_);
     s/\s+$//;
+    s/\s*\n\s*/ /g;
     if ($$self{ITEMS} > 1) {
         $$self{ITEMS} = 0;
         $self->output (".PD\n");
@@ -658,6 +660,7 @@
     my $self = shift;
     local $_ = $self->parse (@_);
     s/\s+$//;
+    s/\s*\n\s*/ /g;
     if ($$self{ITEMS} > 1) {
         $$self{ITEMS} = 0;
         $self->output (".PD\n");
@@ -673,6 +676,7 @@
     my $self = shift;
     local $_ = $self->parse (@_);
     s/\s+$//;
+    s/\s*\n\s*/ /g;
     if ($$self{ITEMS} > 1) {
         $$self{ITEMS} = 0;
         $self->output (".PD\n");

-- 
Robin Barker                        | Email: Robin.Barker@npl.co.uk
CMSC, Building 10,                  | Phone: +44 (0) 20 8943 7090
National Physical Laboratory,       | Fax:   +44 (0) 20 8977 7091
Teddington, Middlesex, UK. TW11 OLW | WWW:   http://www.npl.co.uk

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About