lib/Pod/t/InputObjects.t See if Pod::InputObjects works
lib/Pod/t/man.t podlators test
lib/Pod/t/parselink.t podlators test
+lib/Pod/t/pod-parser.t podlators test
lib/Pod/t/pod2html-lib.pl pod2html testing library
lib/Pod/t/pod2latex.t See if Pod::LaTeX works
lib/Pod/t/Select.t See if Pod::Select works
# Pod::Man -- Convert POD data to formatted *roff input.
-# $Id: Man.pm,v 2.9 2006-02-19 23:02:35 eagle Exp $
+# $Id: Man.pm,v 2.12 2006-09-16 20:55:41 eagle Exp $
#
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Russ Allbery <rra@stanford.edu>
# 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.09;
+$VERSION = '2.12';
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
DEBUG > 5 and print " Guesswork called on [$_]\n";
# By the time we reach this point, all hypens will be escaped by adding a
- # backslash. We want to do that escaping if they're part of regular words
- # and there's only a single dash, since that's a real hyphen that *roff
- # gets to consider a possible break point. Make sure that a dash after
- # the first character of a word stays non-breaking, however.
+ # backslash. We want to undo that escaping if they're part of regular
+ # words and there's only a single dash, since that's a real hyphen that
+ # *roff gets to consider a possible break point. Make sure that a dash
+ # after the first character of a word stays non-breaking, however.
#
# Note that this is not user-controllable; we pretty much have to do this
# transformation or *roff will mangle the output in unacceptable ways.
s{
- ( (?:\G|^|\s) [a-zA-Z] ) ( \\- )?
- ( (?: [a-zA-Z]+ \\-)+ )
- ( [a-zA-Z]+ ) (?=\s|\Z|\\\ )
+ ( (?:\G|^|\s) [\(\"]* [a-zA-Z] ) ( \\- )?
+ ( (?: [a-zA-Z\']+ \\-)+ )
+ ( [a-zA-Z\']+ ) (?= [\)\".?!,;:]* (?:\s|\Z|\\\ ) )
\b
} {
my ($prefix, $hyphen, $main, $suffix) = ($1, $2, $3, $4);
.\\"
.IX Title "$index"
.TH $name $section "$date" "$$self{release}" "$$self{center}"
+.\\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
----END OF HEADER----
$self->output (".\\\" [End of preamble]\n") if DEBUG;
}
sub parse_from_file {
my $self = shift;
$self->reinit;
+
+ # Fake the old cutting option to Pod::Parser. This fiddings with internal
+ # Pod::Simple state and is quite ugly; we need a better approach.
+ if (ref ($_[0]) eq 'HASH') {
+ my $opts = shift @_;
+ if (defined ($$opts{-cutting}) && !$$opts{-cutting}) {
+ $$self{in_pod} = 1;
+ $$self{last_was_blank} = 1;
+ }
+ }
+
+ # Do the work.
my $retval = $self->SUPER::parse_from_file (@_);
+
+ # Flush output, since Pod::Simple doesn't do this. Ideally we should also
+ # close the file descriptor if we had to open one, but we can't easily
+ # figure this out.
my $fh = $self->output_fh ();
my $oldfh = select $fh;
my $oldflush = $|;
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. rr F
.\}
.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
# Pod::Text -- Convert POD data to formatted ASCII text.
-# $Id: Text.pm,v 3.7 2006-02-19 23:02:35 eagle Exp $
+# $Id: Text.pm,v 3.8 2006-09-16 20:55:41 eagle Exp $
#
# Copyright 1999, 2000, 2001, 2002, 2004, 2006
# by Russ Allbery <rra@stanford.edu>
# 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 = 3.07;
+$VERSION = 3.08;
##############################################################################
# Initialization
sub parse_from_file {
my $self = shift;
$self->reinit;
+
+ # Fake the old cutting option to Pod::Parser. This fiddings with internal
+ # Pod::Simple state and is quite ugly; we need a better approach.
+ if (ref ($_[0]) eq 'HASH') {
+ my $opts = shift @_;
+ if (defined ($$opts{-cutting}) && !$$opts{-cutting}) {
+ $$self{in_pod} = 1;
+ $$self{last_was_blank} = 1;
+ }
+ }
+
+ # Do the work.
my $retval = $self->Pod::Simple::parse_from_file (@_);
+
+ # Flush output, since Pod::Simple doesn't do this. Ideally we should also
+ # close the file descriptor if we had to open one, but we can't easily
+ # figure this out.
my $fh = $self->output_fh ();
my $oldfh = select $fh;
my $oldflush = $|;
.Sp
This paragraph should only be singly indented.
.IP "\(bu" 4
-This is an item in the middle of a block\-quote, which should be allowed.
+This is an item in the middle of a block-quote, which should be allowed.
.IP "\(bu" 4
We're also testing tagless item commands.
.RE
Try to get this bit of text over towards the edge so |that\ all\ of\ this\ text\ inside\ S<>\ won't| be wrapped. Also test the
|same\ thing\ with\ non-breaking\ spaces.|
.PP
-There is a soft hy\%phen in hyphen at hy\-phen.
+There is a soft hy\%phen in hyphen at hy-phen.
.PP
This is a test of an index entry.
.IX Xref "index entry"
#!/usr/bin/perl -w
-# $Id: basic.t,v 1.10 2006-01-28 22:31:50 eagle Exp $
+# $Id: basic.t,v 1.11 2006-09-16 20:25:25 eagle Exp $
#
# basic.t -- Basic tests for podlators.
#
open (OUTPUT, "> out.$translators{$_}")
or die "Cannot create out.$translators{$_}: $!\n";
local $_;
- while (<TMP>) { last if /^\.TH/ }
+ while (<TMP>) { last if /^\.nh/ }
print OUTPUT while <TMP>;
close OUTPUT;
close TMP;
#!/usr/bin/perl -w
-# $Id: filehandle.t,v 1.1 2006-02-19 23:02:37 eagle Exp $
+# $Id: filehandle.t,v 1.2 2006-09-16 20:25:25 eagle Exp $
#
# filehandle.t -- Test the parse_from_filehandle interface.
#
close IN;
close OUT;
open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
- while (<OUT>) { last if /^\.TH/ }
+ while (<OUT>) { last if /^\.nh/ }
my $output;
{
local $/;
#!/usr/bin/perl -w
-# $Id: man.t,v 1.9 2006-01-28 22:31:50 eagle Exp $
+# $Id: man.t,v 1.10 2006-09-16 20:25:25 eagle Exp $
#
# man.t -- Additional specialized tests for Pod::Man.
#
$parser->parse_from_file ('tmp.pod', \*OUT);
close OUT;
open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
- while (<OUT>) { last if /^\.TH/ }
+ while (<OUT>) { last if /^\.nh/ }
my $output;
{
local $/;
###
=head1 Hyphen in SE<lt>E<gt>
-Don't S<transform even-this hyphen>.
+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.
+Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However,
+$\-0.13 should have a real hyphen.
###
--- /dev/null
+#!/usr/bin/perl -w
+# $Id: pod-parser.t,v 1.2 2006-09-16 21:09:57 eagle Exp $
+#
+# pod-parser.t -- Tests for backward compatibility with Pod::Parser.
+#
+# Copyright 2006 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.
+
+BEGIN {
+ chdir 't' if -d 't';
+ if ($ENV{PERL_CORE}) {
+ @INC = '../lib';
+ } else {
+ unshift (@INC, '../blib/lib');
+ }
+ unshift (@INC, '../blib/lib');
+ $| = 1;
+ print "1..3\n";
+}
+
+END {
+ print "not ok 1\n" unless $loaded;
+}
+
+use Pod::Man;
+use Pod::Text;
+
+$loaded = 1;
+print "ok 1\n";
+
+my $parser = Pod::Man->new or die "Cannot create parser\n";
+open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
+print TMP "Some random B<text>.\n";
+close TMP;
+open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
+$parser->parse_from_file ({ -cutting => 0 }, '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;
+if ($output eq "Some random \\fBtext\\fR.\n") {
+ print "ok 2\n";
+} else {
+ print "not ok 2\n";
+ print "Expected\n========\nSome random \\fBtext\\fR.\n\n";
+ print "Output\n======\n$output\n";
+}
+
+$parser = Pod::Text->new or die "Cannot create parser\n";
+open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
+$parser->parse_from_file ({ -cutting => 0 }, 'tmp.pod', \*OUT);
+close OUT;
+open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
+{
+ local $/;
+ $output = <OUT>;
+}
+close OUT;
+if ($output eq " Some random text.\n\n") {
+ print "ok 3\n";
+} else {
+ print "not ok 3\n";
+ print "Expected\n========\n Some random text.\n\n\n";
+ print "Output\n======\n$output\n";
+}
+
+unlink ('tmp.pod', 'out.tmp');
+exit 0;