Subject: | roff output for S< > space at end of paragraph |
Date: | Thu, 30 Sep 2010 09:48:17 +1000 |
To: | bug-podlators [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
In Pod::Man 2.23 of podlators 2.3.1 and recent debian perl 5.10.1, if a
paragraph ends with an S< > non-breaking space then the roff output has
a backslashed newline causing the following directive to appear
literally.
For example foo.pod below gives
hello\
.PP
world
which groff formats as
hello.PP world
I'm not sure if a non-breaking space at the end should be preserved, or
trimmed like other trailing space. The change below works for me to
keep it.
--- Man.pm.orig 2010-09-30 09:39:02.000000000 +1000
+++ Man.pm 2010-09-30 09:39:41.000000000 +1000
@@ -949,8 +949,9 @@
if defined ($line) && DEBUG && !$$self{IN_NAME};
# Force exactly one newline at the end and strip unwanted trailing
- # whitespace at the end.
- $text =~ s/\s*$/\n/;
+ # whitespace at the end, but leave "\ " backslashed space from an S< >
+ # at the end of a line.
+ $text =~ s/(?<!\\)\s*$/\n/;
# Output the paragraph.
$self->output ($self->protect ($self->textmapfonts ($text)));