diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2016-11-08 14:02:01 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2016-11-08 14:02:01 +0000 |
commit | a7ea90b1451006596c4574b1e65894f0bda1bafc (patch) | |
tree | 5d02c7c8846588355a84c4dee4854304c9181838 /cpan | |
parent | 83abb366082c0c09544178aa03e4ae14f4a1fed5 (diff) | |
download | perl-a7ea90b1451006596c4574b1e65894f0bda1bafc.tar.gz |
Upgrade podlators from version 4.08 to 4.09
Diffstat (limited to 'cpan')
44 files changed, 753 insertions, 711 deletions
diff --git a/cpan/podlators/lib/Pod/Man.pm b/cpan/podlators/lib/Pod/Man.pm index a0872b4609..886f614c7e 100644 --- a/cpan/podlators/lib/Pod/Man.pm +++ b/cpan/podlators/lib/Pod/Man.pm @@ -43,7 +43,7 @@ BEGIN { @ISA = qw(Pod::Simple); -$VERSION = '4.08'; +$VERSION = '4.09'; # Set the debugging level. If someone has inserted a debug function into this # class already, use that. Otherwise, use any Pod::Simple debug function diff --git a/cpan/podlators/lib/Pod/ParseLink.pm b/cpan/podlators/lib/Pod/ParseLink.pm index c9b964b5cd..9a37a0532c 100644 --- a/cpan/podlators/lib/Pod/ParseLink.pm +++ b/cpan/podlators/lib/Pod/ParseLink.pm @@ -31,7 +31,7 @@ use Exporter; @ISA = qw(Exporter); @EXPORT = qw(parselink); -$VERSION = '4.08'; +$VERSION = '4.09'; ############################################################################## # Implementation diff --git a/cpan/podlators/lib/Pod/Text.pm b/cpan/podlators/lib/Pod/Text.pm index 240e8a9e3a..211de5a7de 100644 --- a/cpan/podlators/lib/Pod/Text.pm +++ b/cpan/podlators/lib/Pod/Text.pm @@ -1,4 +1,4 @@ -# Pod::Text -- Convert POD data to formatted text. +# Convert POD data to formatted text. # # This module converts POD to formatted text. It replaces the old Pod::Text # module that came with versions of Perl prior to 5.6.0 and attempts to match @@ -12,7 +12,7 @@ # standard Perl mailing lists. # # Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009, 2012, 2013, 2014, -# 2015 Russ Allbery <rra@cpan.org> +# 2015, 2016 Russ Allbery <rra@cpan.org> # # This program is free software; you may redistribute it and/or modify it # under the same terms as Perl itself. @@ -39,7 +39,26 @@ use Pod::Simple (); # We have to export pod2text for backward compatibility. @EXPORT = qw(pod2text); -$VERSION = '4.08'; +$VERSION = '4.09'; + +# Ensure that $Pod::Simple::nbsp and $Pod::Simple::shy are available. Code +# taken from Pod::Simple 3.32, but was only added in 3.30. +my ($NBSP, $SHY); +if ($Pod::Simple::VERSION ge 3.30) { + $NBSP = $Pod::Simple::nbsp; + $SHY = $Pod::Simple::shy; +} else { + if ($] ge 5.007_003) { + $NBSP = chr utf8::unicode_to_native(0xA0); + $SHY = chr utf8::unicode_to_native(0xAD); + } elsif (Pod::Simple::ASCII) { + $NBSP = "\xA0"; + $SHY = "\xAD"; + } else { + $NBSP = "\x41"; + $SHY = "\xCA"; + } +} ############################################################################## # Initialization @@ -273,7 +292,12 @@ sub reformat { sub output { my ($self, @text) = @_; my $text = join ('', @text); - $text =~ tr/\240\255/ /d; + if ($NBSP) { + $text =~ s/$NBSP/ /g; + } + if ($SHY) { + $text =~ s/$SHY//g; + } unless ($$self{opt_utf8}) { my $encoding = $$self{encoding} || ''; if ($encoding && $encoding ne $$self{ENCODING}) { @@ -999,7 +1023,7 @@ how to use Pod::Simple. =head1 COPYRIGHT AND LICENSE Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009, 2012, 2013, 2014, -2015 Russ Allbery <rra@cpan.org> +2015, 2016 Russ Allbery <rra@cpan.org> This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. diff --git a/cpan/podlators/lib/Pod/Text/Color.pm b/cpan/podlators/lib/Pod/Text/Color.pm index ccd46c6f46..a26e43db81 100644 --- a/cpan/podlators/lib/Pod/Text/Color.pm +++ b/cpan/podlators/lib/Pod/Text/Color.pm @@ -27,7 +27,7 @@ use vars qw(@ISA $VERSION); @ISA = qw(Pod::Text); -$VERSION = '4.08'; +$VERSION = '4.09'; ############################################################################## # Overrides diff --git a/cpan/podlators/lib/Pod/Text/Overstrike.pm b/cpan/podlators/lib/Pod/Text/Overstrike.pm index a2ba5bb829..f611a4225b 100644 --- a/cpan/podlators/lib/Pod/Text/Overstrike.pm +++ b/cpan/podlators/lib/Pod/Text/Overstrike.pm @@ -35,7 +35,7 @@ use Pod::Text (); @ISA = qw(Pod::Text); -$VERSION = '4.08'; +$VERSION = '4.09'; ############################################################################## # Overrides diff --git a/cpan/podlators/lib/Pod/Text/Termcap.pm b/cpan/podlators/lib/Pod/Text/Termcap.pm index b0823e00fa..91939331f8 100644 --- a/cpan/podlators/lib/Pod/Text/Termcap.pm +++ b/cpan/podlators/lib/Pod/Text/Termcap.pm @@ -28,7 +28,7 @@ use vars qw(@ISA $VERSION); @ISA = qw(Pod::Text); -$VERSION = '4.08'; +$VERSION = '4.09'; ############################################################################## # Overrides diff --git a/cpan/podlators/t/data/snippets/man/agrave b/cpan/podlators/t/data/snippets/man/agrave new file mode 100644 index 0000000000..c1ec02655a --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/agrave @@ -0,0 +1,12 @@ +[name] +E<agrave> + +[input] +=head1 agrave + +Open E<agrave> la shell. Previous versions mapped it wrong. + +[output] +.SH "agrave" +.IX Header "agrave" +Open a\*` la shell. Previous versions mapped it wrong. diff --git a/cpan/podlators/t/data/snippets/man/backslash-man-ref b/cpan/podlators/t/data/snippets/man/backslash-man-ref new file mode 100644 index 0000000000..72463ce1a8 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/backslash-man-ref @@ -0,0 +1,10 @@ +[name] +Backlash man page reference + +[input] +=pod + +Not a man page reference: \s0(1) + +[output] +Not a man page reference: \es0(1) diff --git a/cpan/podlators/t/data/snippets/man/bullets b/cpan/podlators/t/data/snippets/man/bullets new file mode 100644 index 0000000000..8cab7e9e52 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/bullets @@ -0,0 +1,25 @@ +[name] +Bullet handling + +[input] +=over 4 + +=item * + +A bullet. + +=item * + +Another bullet. + +=item * Also a bullet. + +=back + +[output] +.IP "\(bu" 4 +A bullet. +.IP "\(bu" 4 +Another bullet. +.IP "\(bu" 4 +Also a bullet. diff --git a/cpan/podlators/t/data/snippets/man/c-in-header b/cpan/podlators/t/data/snippets/man/c-in-header new file mode 100644 index 0000000000..068363c01b --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/c-in-header @@ -0,0 +1,10 @@ +[name] +C<> in headers + +[input] +=head1 C<one> and C<two> + +[output] +.ie n .SH """one"" and ""two""" +.el .SH "\f(CWone\fP and \f(CWtwo\fP" +.IX Header "one and two" diff --git a/cpan/podlators/t/data/snippets/man/c-in-name b/cpan/podlators/t/data/snippets/man/c-in-name new file mode 100644 index 0000000000..e17952d0d5 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/c-in-name @@ -0,0 +1,11 @@ +[name] +C<> in NAME + +[input] +=head1 NAME + +test - C<test> + +[output] +.SH "NAME" +test \- "test" diff --git a/cpan/podlators/t/data/snippets/man/dollar-magic b/cpan/podlators/t/data/snippets/man/dollar-magic new file mode 100644 index 0000000000..2634732971 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/dollar-magic @@ -0,0 +1,24 @@ +[name] +Magic for dollar strings + +[input] +=head1 MAGIC MONEY + +These should be identical. + +Bippity boppity boo "The +price is $Z<>100." + +Bippity boppity boo "The +price is $100." + +[output] +.SH "MAGIC MONEY" +.IX Header "MAGIC MONEY" +These should be identical. +.PP +Bippity boppity boo \*(L"The +price is \f(CW$100\fR.\*(R" +.PP +Bippity boppity boo \*(L"The +price is \f(CW$100\fR.\*(R" diff --git a/cpan/podlators/t/data/snippets/man/eth b/cpan/podlators/t/data/snippets/man/eth new file mode 100644 index 0000000000..6583ccb1fd --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/eth @@ -0,0 +1,10 @@ +[name] +E<eth> + +[input] +=pod + +E<eth> + +[output] +\&\*(d- diff --git a/cpan/podlators/t/data/snippets/man/fixed-font-in-item b/cpan/podlators/t/data/snippets/man/fixed-font-in-item new file mode 100644 index 0000000000..e096fd4cd6 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/fixed-font-in-item @@ -0,0 +1,29 @@ +[name] +Fixed-width font in item + +[input] +=head1 Fixed-width Fonts in =item + +The nroff portion should not use fixed-width fonts. In podlators 4.06 and +earlier, italic was terminated with \f(CW, which didn't properly stop italic. + +=over 2 + +=item C<tar I<option>... [I<name>]...> + +=item C<tar I<letter>... [I<argument>]... [I<option>]... [I<name>]...> + +=back + +[output] +.SH "Fixed-width Fonts in =item" +.IX Header "Fixed-width Fonts in =item" +The nroff portion should not use fixed-width fonts. In podlators 4.06 and +earlier, italic was terminated with \ef(\s-1CW,\s0 which didn't properly stop italic. +.ie n .IP """tar \fIoption\fP... [\fIname\fP]...""" 2 +.el .IP "\f(CWtar \f(CIoption\f(CW... [\f(CIname\f(CW]...\fR" 2 +.IX Item "tar option... [name]..." +.PD 0 +.ie n .IP """tar \fIletter\fP... [\fIargument\fP]... [\fIoption\fP]... [\fIname\fP]...""" 2 +.el .IP "\f(CWtar \f(CIletter\f(CW... [\f(CIargument\f(CW]... [\f(CIoption\f(CW]... [\f(CIname\f(CW]...\fR" 2 +.IX Item "tar letter... [argument]... [option]... [name]..." diff --git a/cpan/podlators/t/data/snippets/man/for-blocks b/cpan/podlators/t/data/snippets/man/for-blocks new file mode 100644 index 0000000000..5054f728b9 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/for-blocks @@ -0,0 +1,33 @@ +[name] +=for blocks + +[input] +=pod + +Some text. + +=for man +Some raw nroff. + +=for roff \fBBold text.\fP + +=for html +Stuff that's hidden. + +=for MAN \fIItalic text.\fP + +=for ROFF +.PP +\&A paragraph. + +More text. + +[output] +Some text. +Some raw nroff. +\fBBold text.\fP +\fIItalic text.\fP +.PP +\&A paragraph. +.PP +More text. diff --git a/cpan/podlators/t/data/snippets/man/hyphen-in-s b/cpan/podlators/t/data/snippets/man/hyphen-in-s new file mode 100644 index 0000000000..dbadd44a5f --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/hyphen-in-s @@ -0,0 +1,14 @@ +[name] +Hyphen in S<> + +[input] +=head1 Hyphen in SE<lt>E<gt> + +Don't S<transform even-this hyphen>. This "one's-fine!", as well. However, +$-0.13 should have a real hyphen. + +[output] +.SH "Hyphen in S<>" +.IX Header "Hyphen in S<>" +Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However, +$\-0.13 should have a real hyphen. diff --git a/cpan/podlators/t/data/snippets/man/iso-8859-1 b/cpan/podlators/t/data/snippets/man/iso-8859-1 new file mode 100644 index 0000000000..6486e7741e --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/iso-8859-1 @@ -0,0 +1,28 @@ +[name] +ISO-8859-1 encoding + +[input] +=encoding iso-8859-1 + +=head1 ACCENTS + +Beyoncé! Beyoncé! Beyoncé!! + + Beyoncé! Beyoncé! + Beyoncé! Beyoncé! + Beyoncé! Beyoncé! + +Older versions didn't convert Beyoncé in verbatim. + +[output] +.SH "ACCENTS" +.IX Header "ACCENTS" +Beyonce\*'! Beyonce\*'! Beyonce\*'!! +.PP +.Vb 3 +\& Beyonce\*'! Beyonce\*'! +\& Beyonce\*'! Beyonce\*'! +\& Beyonce\*'! Beyonce\*'! +.Ve +.PP +Older versions didn't convert Beyonce\*' in verbatim. diff --git a/cpan/podlators/t/data/snippets/man/item-fonts b/cpan/podlators/t/data/snippets/man/item-fonts new file mode 100644 index 0000000000..e695cc3da3 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/item-fonts @@ -0,0 +1,14 @@ +[name] +Fonts in items + +[input] +=over 4 + +=item 1. Check fonts in @CARP_NOT test. + +=back + +[output] +.ie n .IP "1. Check fonts in @CARP_NOT test." 4 +.el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4 +.IX Item "1. Check fonts in @CARP_NOT test." diff --git a/cpan/podlators/t/data/snippets/man/link-quoting b/cpan/podlators/t/data/snippets/man/link-quoting new file mode 100644 index 0000000000..9f9157a38a --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/link-quoting @@ -0,0 +1,12 @@ +[name] +Link quoting + +[input] +=head1 LINK QUOTING + +There should not be double quotes: L<C<< (?>pattern) >>>. + +[output] +.SH "LINK QUOTING" +.IX Header "LINK QUOTING" +There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR. diff --git a/cpan/podlators/t/data/snippets/man/link-to-url b/cpan/podlators/t/data/snippets/man/link-to-url new file mode 100644 index 0000000000..7f81e3c7f8 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/link-to-url @@ -0,0 +1,25 @@ +[name] +Link to URL + +[input] +=head1 LINK TO URL + +This is a L<link|http://www.example.com/> to a URL. + +The newest version of this document is also available on the World Wide Web at +L<http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod>. + +=head1 RT LINK + +L<[perl #12345]|https://rt.cpan.org/12345> + +[output] +.SH "LINK TO URL" +.IX Header "LINK TO URL" +This is a link <http://www.example.com/> to a \s-1URL.\s0 +.PP +The newest version of this document is also available on the World Wide Web at +<http://pod.tst.eu/http://cvs.schmorp.de/rxvt\-unicode/doc/rxvt.7.pod>. +.SH "RT LINK" +.IX Header "RT LINK" +[perl #12345] <https://rt.cpan.org/12345> diff --git a/cpan/podlators/t/data/snippets/man/markup-in-name b/cpan/podlators/t/data/snippets/man/markup-in-name new file mode 100644 index 0000000000..de27acddf1 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/markup-in-name @@ -0,0 +1,11 @@ +[name] +Various markup in NAME + +[input] +=head1 NAME + +test - B<test> I<italics> F<file> + +[output] +.SH "NAME" +test \- test italics file diff --git a/cpan/podlators/t/data/snippets/man/multiline-x b/cpan/podlators/t/data/snippets/man/multiline-x new file mode 100644 index 0000000000..641e4a49d3 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/multiline-x @@ -0,0 +1,14 @@ +[name] +Multiline X<> + +[input] +=head1 Multiline XZ<><> + +Something something X<this is +one index term> + +[output] +.SH "Multiline X<>" +.IX Header "Multiline X<>" +Something something +.IX Xref "this is one index term" diff --git a/cpan/podlators/t/data/snippets/man/name-guesswork b/cpan/podlators/t/data/snippets/man/name-guesswork new file mode 100644 index 0000000000..6eecd9a36e --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/name-guesswork @@ -0,0 +1,18 @@ +[name] +No guesswork in NAME + +[input] +=head1 NAME + +"Stuff" (no guesswork) + +=head2 THINGS + +Oboy, is this C++ "fun" yet! (guesswork) + +[output] +.SH "NAME" +"Stuff" (no guesswork) +.SS "\s-1THINGS\s0" +.IX Subsection "THINGS" +Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork) diff --git a/cpan/podlators/t/data/snippets/man/nested-lists b/cpan/podlators/t/data/snippets/man/nested-lists new file mode 100644 index 0000000000..45d4a58095 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/nested-lists @@ -0,0 +1,30 @@ +[name] +Nested lists + +[input] +=over + +=item First level + +Blah blah blah.... + +=over + +=item * + +Should be a bullet. + +=back + +=back + +[output] +.IP "First level" 4 +.IX Item "First level" +Blah blah blah.... +.RS 4 +.IP "\(bu" 4 +Should be a bullet. +.RE +.RS 4 +.RE diff --git a/cpan/podlators/t/data/snippets/man/newlines-in-c b/cpan/podlators/t/data/snippets/man/newlines-in-c new file mode 100644 index 0000000000..c053c4b4ef --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/newlines-in-c @@ -0,0 +1,14 @@ +[name] +Quoting with C<> and newlines + +[input] +=head1 Newline C Quote Weirdness + +Blorp C<' +''>. Yes. + +[output] +.SH "Newline C Quote Weirdness" +.IX Header "Newline C Quote Weirdness" +Blorp \f(CW\*(Aq +\&\*(Aq\*(Aq\fR. Yes. diff --git a/cpan/podlators/t/data/snippets/man/non-ascii b/cpan/podlators/t/data/snippets/man/non-ascii new file mode 100644 index 0000000000..739690f9ac --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/non-ascii @@ -0,0 +1,12 @@ +[name] +Non-ASCII character + +[input] +=head1 YEN + +It cost me E<165>12345! That should be an X. + +[output] +.SH "YEN" +.IX Header "YEN" +It cost me X12345! That should be an X. diff --git a/cpan/podlators/t/data/snippets/man/not-bullet b/cpan/podlators/t/data/snippets/man/not-bullet new file mode 100644 index 0000000000..8b468f0f02 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/not-bullet @@ -0,0 +1,15 @@ +[name] +Escaped bullet + +[input] +=over 4 + +=item Z<>* + +Not bullet. + +=back + +[output] +.IP "*" 4 +Not bullet. diff --git a/cpan/podlators/t/data/snippets/man/not-numbers b/cpan/podlators/t/data/snippets/man/not-numbers new file mode 100644 index 0000000000..ecb48f1094 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/not-numbers @@ -0,0 +1,30 @@ +[name] +Lists not parsed as numbers + +[input] +=over 4 + +=item 1. Not a number + +=item 2. Spaced right + +=back + +=over 2 + +=item 1 Not a number + +=item 2 Spaced right + +=back + +[output] +.IP "1. Not a number" 4 +.IX Item "1. Not a number" +.PD 0 +.IP "2. Spaced right" 4 +.IX Item "2. Spaced right" +.IP "1 Not a number" 2 +.IX Item "1 Not a number" +.IP "2 Spaced right" 2 +.IX Item "2 Spaced right" diff --git a/cpan/podlators/t/data/snippets/man/paired-quotes b/cpan/podlators/t/data/snippets/man/paired-quotes new file mode 100644 index 0000000000..f81ed8a2a4 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/paired-quotes @@ -0,0 +1,20 @@ +[name] +Paired quotes + +[input] +=head1 SEQS + +"=over ... Z<>=back" + +"SE<lt>...E<gt>" + +The quotes should be converted in the above to paired quotes. + +[output] +.SH "SEQS" +.IX Header "SEQS" +\&\*(L"=over ... =back\*(R" +.PP +\&\*(L"S<...>\*(R" +.PP +The quotes should be converted in the above to paired quotes. diff --git a/cpan/podlators/t/data/snippets/man/periods b/cpan/podlators/t/data/snippets/man/periods new file mode 100644 index 0000000000..afdea425d2 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/periods @@ -0,0 +1,12 @@ +[name] +Quoted periods + +[input] +=head1 PERIODS + +This C<.> should be quoted. + +[output] +.SH "PERIODS" +.IX Header "PERIODS" +This \f(CW\*(C`.\*(C'\fR should be quoted. diff --git a/cpan/podlators/t/data/snippets/man/quote-escaping b/cpan/podlators/t/data/snippets/man/quote-escaping new file mode 100644 index 0000000000..9f0a5946f6 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/quote-escaping @@ -0,0 +1,12 @@ +[name] +Quote escaping + +[input] +=head1 Quote escaping + +Don't escape `this' but do escape C<`this'> (and don't surround it in quotes). + +[output] +.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). diff --git a/cpan/podlators/t/data/snippets/man/small-caps-magic b/cpan/podlators/t/data/snippets/man/small-caps-magic new file mode 100644 index 0000000000..bb5fea6c07 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/small-caps-magic @@ -0,0 +1,12 @@ +[name] +Small caps and unbreakable magic + +[input] +=head1 SE<lt>E<gt> MAGIC + +Magic should be applied S<RISC OS> to that. + +[output] +.SH "S<> MAGIC" +.IX Header "S<> MAGIC" +Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that. diff --git a/cpan/podlators/t/data/snippets/man/soft-hyphens b/cpan/podlators/t/data/snippets/man/soft-hyphens new file mode 100644 index 0000000000..48c1235768 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/soft-hyphens @@ -0,0 +1,40 @@ +[name] +Soft hyphens + +[input] +=head1 Soft Hypen Testing + +sigE<shy>action +manuE<shy>script +JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi + +And again: + +sigE<173>action +manuE<173>script +JarkE<173>ko HieE<173>taE<173>nieE<173>mi + +And one more time: + +sigE<0x00AD>action +manuE<0x00AD>script +JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi + +[output] +.SH "Soft Hypen Testing" +.IX Header "Soft Hypen Testing" +sig\%action +manu\%script +Jark\%ko Hie\%ta\%nie\%mi +.PP +And again: +.PP +sig\%action +manu\%script +Jark\%ko Hie\%ta\%nie\%mi +.PP +And one more time: +.PP +sig\%action +manu\%script +Jark\%ko Hie\%ta\%nie\%mi diff --git a/cpan/podlators/t/data/snippets/man/trailing-space b/cpan/podlators/t/data/snippets/man/trailing-space new file mode 100644 index 0000000000..32c755e55c --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/trailing-space @@ -0,0 +1,20 @@ +[name] +Trailing protected space + +[input] +=head1 TRAILING SPACE + +HelloS< > + +worldS< > + +. + +[output] +.SH "TRAILING SPACE" +.IX Header "TRAILING SPACE" +Hello\ +.PP +world\ \ \ +.PP +\&. diff --git a/cpan/podlators/t/data/snippets/man/true-false b/cpan/podlators/t/data/snippets/man/true-false new file mode 100644 index 0000000000..6f0e4e0f3c --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/true-false @@ -0,0 +1,16 @@ +[name] +TRUE (1) and FALSE (0) + +[input] +=head1 TRUE (1) + +podlators prior to 4.08 misrendered TRUE (1) and FALSE (0) with escaped nroff +in the output because it tried to apply both small caps and man page reference +code and got it wrong. + +[output] +.SH "TRUE (1)" +.IX Header "TRUE (1)" +podlators prior to 4.08 misrendered \s-1TRUE\s0 (1) and \s-1FALSE\s0 (0) with escaped nroff +in the output because it tried to apply both small caps and man page reference +code and got it wrong. diff --git a/cpan/podlators/t/data/snippets/man/uppercase-license b/cpan/podlators/t/data/snippets/man/uppercase-license new file mode 100644 index 0000000000..4c02452f06 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/uppercase-license @@ -0,0 +1,24 @@ +[name] +Uppercase license text + +[input] +=head1 Uppercase License + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +[output] +.SH "Uppercase License" +.IX Header "Uppercase License" +\&\s-1THE SOFTWARE IS PROVIDED \*(L"AS IS\*(R", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\s0 diff --git a/cpan/podlators/t/data/snippets/man/x-whitespace b/cpan/podlators/t/data/snippets/man/x-whitespace new file mode 100644 index 0000000000..367b29ee15 --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/x-whitespace @@ -0,0 +1,13 @@ +[name] +Whitespace around X<> + +[input] +=head1 XE<lt>E<gt> Whitespace + +Blorpy L<B<prok>|blap> X<bivav> wugga chachacha. + +[output] +.SH "X<> Whitespace" +.IX Header "X<> Whitespace" +Blorpy \fBprok\fR wugga chachacha. +.IX Xref "bivav" diff --git a/cpan/podlators/t/data/snippets/man/x-whitespace-entry b/cpan/podlators/t/data/snippets/man/x-whitespace-entry new file mode 100644 index 0000000000..8ec01ace0b --- /dev/null +++ b/cpan/podlators/t/data/snippets/man/x-whitespace-entry @@ -0,0 +1,13 @@ +[name] +X<> matching whitespace + +[input] +=head1 INDEX + +Index entry matching a whitespace escape.X<\n> + +[output] +.SH "INDEX" +.IX Header "INDEX" +Index entry matching a whitespace escape. +.IX Xref "\\n" diff --git a/cpan/podlators/t/lib/Test/Podlators.pm b/cpan/podlators/t/lib/Test/Podlators.pm index d0a8ffaab4..63795b1ef0 100644 --- a/cpan/podlators/t/lib/Test/Podlators.pm +++ b/cpan/podlators/t/lib/Test/Podlators.pm @@ -31,7 +31,7 @@ our (@EXPORT_OK, @ISA, $VERSION); # consistency is good). BEGIN { @ISA = qw(Exporter); - $VERSION = '2.00'; + $VERSION = '2.01'; @EXPORT_OK = qw( read_snippet read_test_data slurp test_snippet test_snippet_with_io ); @@ -93,7 +93,8 @@ sub _stderr_restore { # Read one test snippet from the provided relative file name and return it. # For the format, see t/data/snippets/README. # -# $path - Relative path to read test data from +# $path - Relative path to read test data from +# $encoding - Encoding of snippet (UTF-8 if not specified) # # Returns: Reference to hash of test data with the following keys: # name - Name of the test for status reporting @@ -103,15 +104,16 @@ sub _stderr_restore { # errors - Expected errors # exception - Text of exception (with file and line stripped) sub read_snippet { - my ($path) = @_; + my ($path, $encoding) = @_; $path = File::Spec->catfile('t', 'data', 'snippets', $path); + $encoding ||= 'UTF-8'; my %data; # Read the sections and store them in the %data hash. my ($line, $section); open(my $fh, '<', $path) or BAIL_OUT("cannot open $path: $!"); while (defined($line = <$fh>)) { - $line = decode('UTF-8', $line); + $line = decode($encoding, $line); if ($line =~ m{ \A \s* \[ (\S+) \] \s* \z }xms) { $section = $1; } elsif ($section) { @@ -246,11 +248,14 @@ sub slurp { # loading the snippet, creating the formatter, running it, and checking the # results, and reports those results with Test::More. # -# $class - Class name of the formatter, as a string -# $snippet - Path to the snippet file defining the test +# $class - Class name of the formatter, as a string +# $snippet - Path to the snippet file defining the test +# $options_ref - Hash of options with the following keys: +# encoding - Set to use a non-standard encoding sub test_snippet { - my ($class, $snippet) = @_; - my $data_ref = read_snippet($snippet); + my ($class, $snippet, $options_ref) = @_; + my $encoding = defined($options_ref) ? $options_ref->{encoding} : undef; + my $data_ref = read_snippet($snippet, $encoding); # Create the formatter object. my $parser = $class->new(%{ $data_ref->{options} }, name => 'TEST'); @@ -391,14 +396,14 @@ should be explicitly imported. =over 4 -=item read_snippet(PATH[, OPTIONS]) +=item read_snippet(PATH[, ENCODING]) Read one test snippet from the provided relative file name and return it. The path should be relative to F<t/data/snippets>. For the format, see F<t/data/snippets/README>. -OPTIONS, if present, is a hash that currently supports only one key: C<utf8>, -to set a PerlIO input encoding layer of UTF-8 when reading the snippet. +ENCODING, if present, specifies the encoding of the snippet. If not given, +the snippet is assumed to be encoded in C<UTF-8>. The result will be a hash with the following keys: @@ -476,20 +481,24 @@ The output data for the test. This is always present. Read the contents of FILE and return it as a string. If STRIP is set to C<man>, strip off any Pod::Man header from the file before returning it. -=item test_snippet(CLASS, SNIPPET) +=item test_snippet(CLASS, SNIPPET[, OPTIONS]) Test a formatter on a particular POD snippet. This does all the work of loading the snippet, creating the formatter by instantiating CLASS, running it, and checking the results. Results are reported with Test::More. +OPTIONS, if present, is a reference to a hash of options. Currently, only +one key is supported: C<encoding>, which, if set, specifies the encoding of +the snippet. + =item test_snippet_with_io(CLASS, SNIPPET[, OPTIONS]) The same as test_snippet(), except, rather than parsing the input into a string buffer, this function uses real, temporary input and output files. This can be used to test I/O layer handling and proper encoding. -OPTIONS, if present, is a reference to a hash of options. Currently, only -one key is supported: C<perlio>, which, if set to true, will set a PerlIO +OPTIONS, if present, is a reference to a hash of options. Currently, only one +key is supported: C<perlio_utf8>, which, if set to true, will set a PerlIO UTF-8 encoding layer on the output file before writing to it. =back @@ -500,7 +509,7 @@ Russ Allbery <rra@cpan.org> =head1 COPYRIGHT AND LICENSE -Copyright 2015 Russ Allbery <rra@cpan.org> +Copyright 2015, 2016 Russ Allbery <rra@cpan.org> This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. diff --git a/cpan/podlators/t/man/basic.t b/cpan/podlators/t/man/basic.t deleted file mode 100644 index 713394687c..0000000000 --- a/cpan/podlators/t/man/basic.t +++ /dev/null @@ -1,617 +0,0 @@ -#!/usr/bin/perl -w -# -# Additional specialized tests for Pod::Man. -# -# Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014, -# 2016 Russ Allbery <rra@cpan.org> -# -# This program is free software; you may redistribute it and/or modify it -# under the same terms as Perl itself. - -BEGIN { - chdir 't' if -d 't'; - if ($ENV{PERL_CORE}) { - @INC = '../lib'; - } - unshift (@INC, '../blib/lib'); - $| = 1; -} - -use strict; - -use Test::More tests => 37; -BEGIN { use_ok ('Pod::Man') } - -# Test whether we can use binmode to set encoding. -my $have_encoding = (eval { require PerlIO::encoding; 1 } and not $@); - -my $parser = Pod::Man->new; -isa_ok ($parser, 'Pod::Man', 'Parser object'); -my $n = 1; -while (<DATA>) { - next until $_ eq "###\n"; - 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. Hide this in a string eval - # so that older versions of Perl don't croak and minimum-version tests - # still pass. - eval 'binmode (\*TMP, ":encoding(iso-8859-1)")' if $have_encoding; - - while (<DATA>) { - last if $_ eq "###\n"; - print TMP $_; - } - close TMP; - open (OUT, "> out$$.tmp") or die "Cannot create out$$.tmp: $!\n"; - $parser->parse_from_file ("tmp$$.pod", \*OUT); - close OUT; - open (OUT, "out$$.tmp") or die "Cannot open out$$.tmp: $!\n"; - while (<OUT>) { last if /^\.nh/ } - my $output; - { - local $/; - $output = <OUT>; - } - close OUT; - 1 while unlink ("tmp$$.pod", "out$$.tmp"); - my $expected = ''; - while (<DATA>) { - last if $_ eq "###\n"; - $expected .= $_; - } - is ($output, $expected, "Output correct for test $n"); - $n++; -} - -# Below the marker are bits of POD and corresponding expected nroff output. -# This is used to test specific features or problems with Pod::Man. The input -# and output are separated by lines containing only ###. - -__DATA__ - -### -=head1 NAME - -gcc - GNU project C<C> and C++ compiler - -=head1 C++ NOTES - -Other mentions of C++. -### -.SH "NAME" -gcc \- GNU project "C" and C++ compiler -.SH "\*(C+ NOTES" -.IX Header " NOTES" -Other mentions of \*(C+. -### - -### -=head1 PERIODS - -This C<.> should be quoted. -### -.SH "PERIODS" -.IX Header "PERIODS" -This \f(CW\*(C`.\*(C'\fR should be quoted. -### - -### -=over 4 - -=item * - -A bullet. - -=item * - -Another bullet. - -=item * Also a bullet. - -=back -### -.IP "\(bu" 4 -A bullet. -.IP "\(bu" 4 -Another bullet. -.IP "\(bu" 4 -Also a bullet. -### - -### -=encoding iso-8859-1 - -=head1 ACCENTS - -Beyoncé! Beyoncé! Beyoncé!! - - Beyoncé! Beyoncé! - Beyoncé! Beyoncé! - Beyoncé! Beyoncé! - -Older versions didn't convert Beyoncé in verbatim. -### -.SH "ACCENTS" -.IX Header "ACCENTS" -Beyonce\*'! Beyonce\*'! Beyonce\*'!! -.PP -.Vb 3 -\& Beyonce\*'! Beyonce\*'! -\& Beyonce\*'! Beyonce\*'! -\& Beyonce\*'! Beyonce\*'! -.Ve -.PP -Older versions didn't convert Beyonce\*' in verbatim. -### - -### -=over 4 - -=item 1. Not a number - -=item 2. Spaced right - -=back - -=over 2 - -=item 1 Not a number - -=item 2 Spaced right - -=back -### -.IP "1. Not a number" 4 -.IX Item "1. Not a number" -.PD 0 -.IP "2. Spaced right" 4 -.IX Item "2. Spaced right" -.IP "1 Not a number" 2 -.IX Item "1 Not a number" -.IP "2 Spaced right" 2 -.IX Item "2 Spaced right" -### - -### -=over 4 - -=item Z<>* - -Not bullet. - -=back -### -.IP "*" 4 -Not bullet. -### - -### -=head1 SEQS - -"=over ... Z<>=back" - -"SE<lt>...E<gt>" - -The quotes should be converted in the above to paired quotes. -### -.SH "SEQS" -.IX Header "SEQS" -\&\*(L"=over ... =back\*(R" -.PP -\&\*(L"S<...>\*(R" -.PP -The quotes should be converted in the above to paired quotes. -### - -### -=head1 YEN - -It cost me E<165>12345! That should be an X. -### -.SH "YEN" -.IX Header "YEN" -It cost me X12345! That should be an X. -### - -### -=head1 agrave - -Open E<agrave> la shell. Previous versions mapped it wrong. -### -.SH "agrave" -.IX Header "agrave" -Open a\*` la shell. Previous versions mapped it wrong. -### - -### -=over - -=item First level - -Blah blah blah.... - -=over - -=item * - -Should be a bullet. - -=back - -=back -### -.IP "First level" 4 -.IX Item "First level" -Blah blah blah.... -.RS 4 -.IP "\(bu" 4 -Should be a bullet. -.RE -.RS 4 -.RE -### - -### -=over 4 - -=item 1. Check fonts in @CARP_NOT test. - -=back -### -.ie n .IP "1. Check fonts in @CARP_NOT test." 4 -.el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4 -.IX Item "1. Check fonts in @CARP_NOT test." -### - -### -=head1 LINK QUOTING - -There should not be double quotes: L<C<< (?>pattern) >>>. -### -.SH "LINK QUOTING" -.IX Header "LINK QUOTING" -There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR. -### - -### -=head1 SE<lt>E<gt> MAGIC - -Magic should be applied S<RISC OS> to that. -### -.SH "S<> MAGIC" -.IX Header "S<> MAGIC" -Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that. -### - -### -=head1 MAGIC MONEY - -These should be identical. - -Bippity boppity boo "The -price is $Z<>100." - -Bippity boppity boo "The -price is $100." -### -.SH "MAGIC MONEY" -.IX Header "MAGIC MONEY" -These should be identical. -.PP -Bippity boppity boo \*(L"The -price is \f(CW$100\fR.\*(R" -.PP -Bippity boppity boo \*(L"The -price is \f(CW$100\fR.\*(R" -### - -### -=head1 NAME - -"Stuff" (no guesswork) - -=head2 THINGS - -Oboy, is this C++ "fun" yet! (guesswork) -### -.SH "NAME" -"Stuff" (no guesswork) -.SS "\s-1THINGS\s0" -.IX Subsection "THINGS" -Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork) -### - -### -=head1 Newline C Quote Weirdness - -Blorp C<' -''>. Yes. -### -.SH "Newline C Quote Weirdness" -.IX Header "Newline C Quote Weirdness" -Blorp \f(CW\*(Aq -\&\*(Aq\*(Aq\fR. Yes. -### - -### -=head1 Soft Hypen Testing - -sigE<shy>action -manuE<shy>script -JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi - -And again: - -sigE<173>action -manuE<173>script -JarkE<173>ko HieE<173>taE<173>nieE<173>mi - -And one more time: - -sigE<0x00AD>action -manuE<0x00AD>script -JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi -### -.SH "Soft Hypen Testing" -.IX Header "Soft Hypen Testing" -sig\%action -manu\%script -Jark\%ko Hie\%ta\%nie\%mi -.PP -And again: -.PP -sig\%action -manu\%script -Jark\%ko Hie\%ta\%nie\%mi -.PP -And one more time: -.PP -sig\%action -manu\%script -Jark\%ko Hie\%ta\%nie\%mi -### - -### -=head1 XE<lt>E<gt> Whitespace - -Blorpy L<B<prok>|blap> X<bivav> wugga chachacha. -### -.SH "X<> Whitespace" -.IX Header "X<> Whitespace" -Blorpy \fBprok\fR wugga chachacha. -.IX Xref "bivav" -### - -### -=head1 Hyphen in SE<lt>E<gt> - -Don't S<transform even-this hyphen>. This "one's-fine!", as well. However, -$-0.13 should have a real hyphen. -### -.SH "Hyphen in S<>" -.IX Header "Hyphen in S<>" -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). -### - -### -=pod - -E<eth> -### -.PP -\&\*(d- -### - -### -=head1 C<one> and C<two> -### -.ie n .SH """one"" and ""two""" -.el .SH "\f(CWone\fP and \f(CWtwo\fP" -.IX Header "one and two" -### - -### -=pod - -Some text. - -=for man -Some raw nroff. - -=for roff \fBBold text.\fP - -=for html -Stuff that's hidden. - -=for MAN \fIItalic text.\fP - -=for ROFF -.PP -\&A paragraph. - -More text. -### -Some text. -Some raw nroff. -\fBBold text.\fP -\fIItalic text.\fP -.PP -\&A paragraph. -.PP -More text. -### - -### -=head1 NAME - -test - C<test> -### -.SH "NAME" -test \- "test" -### - -### -=head1 INDEX - -Index entry matching a whitespace escape.X<\n> -### -.SH "INDEX" -.IX Header "INDEX" -Index entry matching a whitespace escape. -.IX Xref "\\n" -### - -### -=head1 LINK TO URL - -This is a L<link|http://www.example.com/> to a URL. -### -.SH "LINK TO URL" -.IX Header "LINK TO URL" -This is a link <http://www.example.com/> to a \s-1URL.\s0 -### - -### -=head1 NAME - -test - B<test> I<italics> F<file> -### -.SH "NAME" -test \- test italics file -### - -### -=head1 TRAILING SPACE - -HelloS< > - -worldS< > - -. -### -.SH "TRAILING SPACE" -.IX Header "TRAILING SPACE" -Hello\ -.PP -world\ \ \ -.PP -\&. -### - -### -=head1 URL LINK - -The newest version of this document is also available on the World Wide Web at -L<http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod>. -### -.SH "URL LINK" -.IX Header "URL LINK" -The newest version of this document is also available on the World Wide Web at -<http://pod.tst.eu/http://cvs.schmorp.de/rxvt\-unicode/doc/rxvt.7.pod>. -### - -### -=head1 RT LINK - -L<[perl #12345]|https://rt.cpan.org/12345> -### -.SH "RT LINK" -.IX Header "RT LINK" -[perl #12345] <https://rt.cpan.org/12345> -### - -### -=head1 Multiline XZ<><> - -Something something X<this is -one index term> -### -.SH "Multiline X<>" -.IX Header "Multiline X<>" -Something something -.IX Xref "this is one index term" -### - -### -=head1 Uppercase License - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -### -.SH "Uppercase License" -.IX Header "Uppercase License" -\&\s-1THE SOFTWARE IS PROVIDED \*(L"AS IS\*(R", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\s0 -### - -### -=head1 Fixed-width Fonts in =item - -The nroff portion should not use fixed-width fonts. In podlators 4.06 and -earlier, italic was terminated with \f(CW, which didn't properly stop italic. - -=over 2 - -=item C<tar I<option>... [I<name>]...> - -=item C<tar I<letter>... [I<argument>]... [I<option>]... [I<name>]...> - -=back -### -.SH "Fixed-width Fonts in =item" -.IX Header "Fixed-width Fonts in =item" -The nroff portion should not use fixed-width fonts. In podlators 4.06 and -earlier, italic was terminated with \ef(\s-1CW,\s0 which didn't properly stop italic. -.ie n .IP """tar \fIoption\fP... [\fIname\fP]...""" 2 -.el .IP "\f(CWtar \f(CIoption\f(CW... [\f(CIname\f(CW]...\fR" 2 -.IX Item "tar option... [name]..." -.PD 0 -.ie n .IP """tar \fIletter\fP... [\fIargument\fP]... [\fIoption\fP]... [\fIname\fP]...""" 2 -.el .IP "\f(CWtar \f(CIletter\f(CW... [\f(CIargument\f(CW]... [\f(CIoption\f(CW]... [\f(CIname\f(CW]...\fR" 2 -.IX Item "tar letter... [argument]... [option]... [name]..." -### - -### -=head1 TRUE (1) - -podlators prior to 4.08 misrendered TRUE (1) and FALSE (0) with escaped nroff -in the output because it tried to apply both small caps and man page reference -code and got it wrong. -### -.SH "TRUE (1)" -.IX Header "TRUE (1)" -podlators prior to 4.08 misrendered \s-1TRUE\s0 (1) and \s-1FALSE\s0 (0) with escaped nroff -in the output because it tried to apply both small caps and man page reference -code and got it wrong. -### - -### -=pod - -Not a man page reference: \s0(1) -### -.PP -Not a man page reference: \es0(1) -### diff --git a/cpan/podlators/t/man/empty.t b/cpan/podlators/t/man/empty.t index 613b339b5b..3b70f82662 100644 --- a/cpan/podlators/t/man/empty.t +++ b/cpan/podlators/t/man/empty.t @@ -1,54 +1,66 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # -# man-empty.t -- Test Pod::Man with a document that produces only errors. +# Test Pod::Man with a document that produces only errors. # -# Copyright 2013 Russ Allbery <rra@cpan.org> +# Copyright 2013, 2016 Russ Allbery <rra@cpan.org> # # This program is free software; you may redistribute it and/or modify it # under the same terms as Perl itself. -BEGIN { - chdir 't' if -d 't'; - if ($ENV{PERL_CORE}) { - @INC = '../lib'; - } - unshift (@INC, '../blib/lib'); - $| = 1; -} - +use 5.006; use strict; +use warnings; use Test::More tests => 8; -BEGIN { use_ok ('Pod::Man') } + +# Load the module. +BEGIN { + use_ok('Pod::Man'); +} # Set up Pod::Man to output to a string. my $parser = Pod::Man->new; -isa_ok ($parser, 'Pod::Man'); +isa_ok($parser, 'Pod::Man'); my $output; -$parser->output_string (\$output); - -# Try a POD document where the only command is invalid. With recent -# Pod::Simple, there will be a POD ERRORS section. With older versions of -# Pod::Simple, we have to skip the test since it doesn't trigger this problem. -# Be sure that we don't get any warnings as well as any errors. -local $SIG{__WARN__} = sub { die $_[0] }; -ok (eval { $parser->parse_string_document("=\xa0") }, +$parser->output_string(\$output); + +# Ensure there are no warnings by dying on a warning, forcing a test failure. +local $SIG{__WARN__} = sub { croak($_[0]) }; + +# Try a POD document where the only command is invalid. Make sure it succeeds +# and doesn't throw an exception. +## no critic (ValuesAndExpressions::ProhibitEscapedCharacters) +ok(eval { $parser->parse_string_document("=\xa0") }, 'Parsed invalid document'); -is ($@, '', '...with no errors'); +is($@, q{}, '...with no errors'); +## use critic + +# With recent Pod::Simple, there will be a POD ERRORS section. With older +# versions of Pod::Simple, we have to skip the test since it doesn't trigger +# this problem. SKIP: { - skip 'Pod::Simple does not produce errors for invalid commands', 1 - if $output eq q{}; - like ($output, qr{\.SH \"POD ERRORS\"}, - '...and output contains a POD ERRORS section'); + if ($output eq q{}) { + skip('Pod::Simple does not produce errors for invalid commands', 1); + } + like( + $output, + qr{ [.]SH [ ] "POD [ ] ERRORS" }xms, + '...and output contains a POD ERRORS section' + ); } # Try with a document containing only =cut. -ok (eval { $parser->parse_string_document("=cut") }, - 'Parsed invalid document'); -is ($@, '', '...with no errors'); +ok(eval { $parser->parse_string_document('=cut') }, 'Parsed =cut document'); +is($@, q{}, '...with no errors'); + +# Same check for a POD ERRORS section. SKIP: { - skip 'Pod::Simple does not produce errors for invalid commands', 1 - if $output eq q{}; - like ($output, qr{\.SH \"POD ERRORS\"}, - '...and output contains a POD ERRORS section'); + if ($output eq q{}) { + skip('Pod::Simple does not produce errors for invalid commands', 1); + } + like( + $output, + qr{ [.]SH [ ] "POD [ ] ERRORS" }xms, + '...and output contains a POD ERRORS section' + ); } diff --git a/cpan/podlators/t/man/iso-8859-1.t b/cpan/podlators/t/man/iso-8859-1.t new file mode 100644 index 0000000000..0c1dac38be --- /dev/null +++ b/cpan/podlators/t/man/iso-8859-1.t @@ -0,0 +1,25 @@ +#!/usr/bin/perl +# +# Test Pod::Man ISO-8859-1 handling +# +# Copyright 2016 Russ Allbery <rra@cpan.org> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +use 5.006; +use strict; +use warnings; + +use lib 't/lib'; + +use Test::More tests => 3; +use Test::Podlators qw(test_snippet); + +# Load the module. +BEGIN { + use_ok('Pod::Man'); +} + +# Test the snippet with the proper encoding. +test_snippet('Pod::Man', 'man/iso-8859-1', { encoding => 'iso-8859-1' }); diff --git a/cpan/podlators/t/man/options.t b/cpan/podlators/t/man/options.t deleted file mode 100644 index 20af5dee14..0000000000 --- a/cpan/podlators/t/man/options.t +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/perl -# -# Test Pod::Man behavior with various options -# -# Copyright 2002, 2004, 2006, 2008, 2009, 2012, 2013, 2015, 2016 -# Russ Allbery <rra@cpan.org> -# -# This program is free software; you may redistribute it and/or modify it -# under the same terms as Perl itself. - -use 5.006; -use strict; -use warnings; - -use lib 't/lib'; - -use Test::More tests => 31; -use Test::Podlators qw(test_snippet); - -# Load the module. -BEGIN { - use_ok('Pod::Man'); -} - -# List of snippets run by this test. -my @snippets = qw( - bullet-after-nonbullet error-die error-none error-normal - error-pod error-stderr error-stderr-opt fixed-font long-quote - lquote-and-quote lquote-rquote nourls rquote-none -); - -# Run all the tests. -for my $snippet (@snippets) { - test_snippet('Pod::Man', "man/$snippet"); -} diff --git a/cpan/podlators/t/man/snippets.t b/cpan/podlators/t/man/snippets.t new file mode 100644 index 0000000000..4fa197a7aa --- /dev/null +++ b/cpan/podlators/t/man/snippets.t @@ -0,0 +1,41 @@ +#!/usr/bin/perl +# +# Test Pod::Man behavior with various snippets. +# +# Copyright 2002, 2004, 2006, 2008, 2009, 2012, 2013, 2015, 2016 +# Russ Allbery <rra@cpan.org> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +use 5.006; +use strict; +use warnings; + +use lib 't/lib'; + +use Test::More tests => 93; +use Test::Podlators qw(test_snippet); + +# Load the module. +BEGIN { + use_ok('Pod::Man'); +} + +# List of snippets run by this test. +my @snippets = qw( + agrave backslash-man-ref bullet-after-nonbullet bullets c-in-header + c-in-name dollar-magic error-die error-none error-normal + error-pod error-stderr error-stderr-opt eth fixed-font fixed-font-in-item + for-blocks hyphen-in-s item-fonts link-quoting link-to-url long-quote + lquote-and-quote lquote-rquote markup-in-name multiline-x name-guesswork + nested-lists newlines-in-c non-ascii not-bullet not-numbers nourls + paired-quotes periods quote-escaping rquote-none small-caps-magic + soft-hyphens trailing-space true-false uppercase-license x-whitespace + x-whitespace-entry +); + +# Run all the tests. +for my $snippet (@snippets) { + test_snippet('Pod::Man', "man/$snippet"); +} |