Subject: | Pod::Man on X<> with newline |
Date: | Sun, 30 Dec 2012 10:20:20 +1100 |
To: | bug-podlators [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With Pod::Man 2.26 of podlators 2.4.2 and recent debian i386 perl
5.14.2, running pod2man on the foo.pod below
pod2man foo.pod
produces
.\" Automatically generated by Pod::Man 2.26 (Pod::Simple 3.22)
.IX Xref "Foo,
Bar"
which is displayed by man as
Quux. Bar"
where I hoped that none of the X<> in the input would appear in the
final display, only the plain text
Quux.
I think .IX must be a single line, so any newlines in an X<> cannot be
put through to it. I get some joy by turning them into spaces, on the
assumption that such newlines are a flowed line. Diff below.
Various examples can be found in perltoc.pod. The first is
=item How can I match strings with multibyte characters?
X<regex, and multibyte characters> X<regexp, and multibyte characters>
X<regular expression, and multibyte characters> X<martian> X<encoding,
Show quoted text
Martian>
which is from perlfaq6.pod. The original there has X<encoding, Martian>
on one line, but is somehow flowed in the perltoc version.
perlfaq9.pod itself has an apparently manually created newline,
=head2 How do I find out my hostname, domainname, or IP address?
X<hostname, domainname, IP address, host, domain, hostfqdn, inet_ntoa,
gethostbyname, Socket, Net::Domain, Sys::Hostname>
I imagine that ought to be separate individual X<> for each thing in the
list. In any case all these display the bits of the X<> after the
newline.
=head1 NAME
X<Foo,
Bar>
Quux.
diff -u /home/gg/perl/lib/Pod/Man.pm.orig /home/gg/perl/lib/Pod/Man.pm
--- /home/gg/perl/lib/Pod/Man.pm.orig 2012-12-25 13:27:31.000000000 +1100
+++ /home/gg/perl/lib/Pod/Man.pm 2012-12-25 11:15:30.000000000 +1100
@@ -715,6 +715,7 @@
# Print out the .IX commands.
for (@output) {
my ($type, $entry) = @$_;
+ $entry =~ s/\n/ /g;
$entry =~ s/\"/\"\"/g;
$entry =~ s/\\/\\\\/g;
$self->output (".IX $type " . '"' . $entry . '"' . "\n");
Diff finished. Tue Dec 25 13:27:38 2012