# Pod::Man -- Convert POD data to formatted *roff input.
-# $Id: Man.pm,v 2.12 2006-09-16 20:55:41 eagle Exp $
+# $Id: Man.pm,v 2.16 2007-11-29 01:35:53 eagle Exp $
#
-# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Russ Allbery <rra@stanford.edu>
# Substantial contributions by Sean Burke <sburke@cpan.org>
#
# Don't use the CVS revision as the version, since this module is also in Perl
# core and too many things could munge CVS magic revision strings. This
# number should ideally be the same as the CVS revision in podlators, however.
-$VERSION = '2.12_01';
+$VERSION = '2.16';
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
$options{cleanup} = 0;
} elsif ($element eq 'Verbatim' || $element eq 'C') {
$options{guesswork} = 0;
+ $options{literal} = 1;
}
return \%options;
}
my $guesswork = $$options{guesswork} && !$$self{IN_NAME};
my $cleanup = $$options{cleanup};
my $convert = $$options{convert};
+ my $literal = $$options{literal};
# Normally we do character translation, but we won't even do that in
# <Data> blocks.
$text =~ s/_(?=_)/_\\|/g;
}
+ # Ensure that *roff doesn't convert literal quotes to UTF-8 single quotes,
+ # but don't mess up our accept escapes.
+ if ($literal) {
+ $text =~ s/(?<!\\\*)\'/\\*\(Aq/g;
+ $text =~ s/(?<!\\\*)\`/\\\`/g;
+ }
+
# If guesswork is asked for, do that. This involves more substantial
# formatting based on various heuristics that may only be appropriate for
# particular documents.
^\s*
(?:
( [\'\`\"] ) .* \1 # already quoted
- | \` .* \' # `quoted'
+ | \\\*\(Aq .* \\\*\(Aq # quoted and escaped
+ | \\?\` .* ( \' | \\\*\(Aq ) # `quoted'
| \$+ [\#^]? \S $index # special ($^Foo, $")
| [\$\@%&*]+ \#? [:\'\w]+ $index # plain var or func
| [\$\@%&*]* [:\'\w]+ (?: -> )? \(\s*[^\s,]\s*\) # 0/1-arg func call
my @dirs = File::Spec->splitdir ($dirs);
my $cut = 0;
my $i;
- for ($i = 0; $i < scalar @dirs; $i++) {
- if ($dirs[$i] eq 'lib' && $i+1 < scalar(@dirs) && $dirs[$i + 1] =~ /perl/) {
- $cut = $i + 2;
- last;
- } elsif ($dirs[$i] =~ /perl/) {
+ for ($i = 0; $i < @dirs; $i++) {
+ if ($dirs[$i] =~ /perl/) {
$cut = $i + 1;
- $cut++ if $dirs[$i + 1] eq 'lib';
+ $cut++ if ($dirs[$i + 1] && $dirs[$i + 1] eq 'lib');
last;
}
}
. ds R" ''
'br\}
.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
-.if \nF \{\
+.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
+.el \{\
+. de IX
+..
+.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
by Russ Allbery <rra@stanford.edu>.
This program is free software; you may redistribute it and/or modify it
Lets make sure these work for empty ones too, like \f(CW\*(C`\*(C'\fR and \f(CW\*(C`>>\*(C'\fR
(just to be obnoxious)
.PP
-The statement: \f(CW\*(C`This is dog kind's \f(CIfinest\f(CW hour!\*(C'\fR is a parody of a
+The statement: \f(CW\*(C`This is dog kind\*(Aqs \f(CIfinest\f(CW hour!\*(C'\fR is a parody of a
quotation from Winston Churchill.
.PP
The following tests are added to those:
.PP
.Vb 8
\& use Term::ANSIColor;
-\& print color 'bold blue';
+\& print color \*(Aqbold blue\*(Aq;
\& print "This text is bold blue.\en";
-\& print color 'reset';
+\& print color \*(Aqreset\*(Aq;
\& print "This text is normal.\en";
-\& print colored ("Yellow on magenta.\en", 'yellow on_magenta');
+\& print colored ("Yellow on magenta.\en", \*(Aqyellow on_magenta\*(Aq);
\& print "This text is normal.\en";
-\& print colored ['yellow on_magenta'], "Yellow on magenta.\en";
+\& print colored [\*(Aqyellow on_magenta\*(Aq], "Yellow on magenta.\en";
\&
\& use Term::ANSIColor qw(uncolor);
-\& print uncolor '01;31', "\en";
+\& print uncolor \*(Aq01;31\*(Aq, "\en";
.Ve
.PP
But this isn't verbatim (make sure it wraps properly), and the next
#!/usr/bin/perl -w
-# $Id: man.t,v 1.10 2006-09-16 20:25:25 eagle Exp $
+# $Id: man.t,v 1.12 2007-11-29 01:35:54 eagle Exp $
#
# man.t -- Additional specialized tests for Pod::Man.
#
-# Copyright 2002, 2003, 2004, 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2003, 2004, 2006, 2007 by Russ Allbery <rra@stanford.edu>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..21\n";
+ print "1..22\n";
}
END {
$loaded = 1;
print "ok 1\n";
-my $have_encoding = eval { require PerlIO::encoding; 1; } && ! $@;
-
my $parser = Pod::Man->new or die "Cannot create parser\n";
my $n = 2;
while (<DATA>) {
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
# We have a test in ISO 8859-1 encoding. Make sure that nothing strange
- # happens if Perl thinks the world is Unicode.
- binmode (\*TMP, ':encoding(iso-8859-1)') if $have_encoding;
+ # happens if Perl thinks the world is Unicode. Wrap this in eval so that
+ # older versions of Perl don't croak.
+ eval { binmode (\*TMP, ':encoding(iso-8859-1)') };
while (<DATA>) {
last if $_ eq "###\n";
- no warnings 'utf8';
print TMP $_;
}
close TMP;
###
.SH "Newline C Quote Weirdness"
.IX Header "Newline C Quote Weirdness"
-Blorp \f(CW'
-\&''\fR. Yes.
+Blorp \f(CW\*(Aq
+\&\*(Aq\*(Aq\fR. Yes.
###
###
Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However,
$\-0.13 should have a real hyphen.
###
+
+###
+=head1 Quote escaping
+
+Don't escape `this' but do escape C<`this'> (and don't surround it in quotes).
+###
+.SH "Quote escaping"
+.IX Header "Quote escaping"
+Don't escape `this' but do escape \f(CW\`this\*(Aq\fR (and don't surround it in quotes).
+###
#!/usr/bin/perl -w
-# $Id: text.t,v 1.5 2006-01-28 22:31:50 eagle Exp $
+# $Id: text.t,v 1.6 2007-09-12 00:20:08 eagle Exp $
#
# text.t -- Additional specialized tests for Pod::Text.
#
-# Copyright 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2007 by Russ Allbery <rra@stanford.edu>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..3\n";
+ print "1..4\n";
}
END {
}
use Pod::Text;
+use Pod::Simple;
$loaded = 1;
print "ok 1\n";
}
if ($output eq $expected) {
print "ok $n\n";
+ } elsif ($n == 4 && $Pod::Simple::VERSION < 3.06) {
+ print "ok $n # skip Pod::Simple S<> parsing bug\n";
} else {
print "not ok $n\n";
print "Expected\n========\n$expected\nOutput\n======\n$output\n";
What does "this." end up looking like?
###
+
+###
+=head1 Test of SE<lt>E<gt>
+
+This is some S< > whitespace.
+###
+Test of S<>
+ This is some whitespace.
+###
+==