# Pod::Man -- Convert POD data to formatted *roff input.
-# $Id: Man.pm,v 2.8 2006-01-25 23:56:52 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.08;
+$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);
# Determine the modification date and return that, properly formatted in ISO
# format. If we can't get the modification date of the input, instead use the
-# current time.
+# current time. Pod::Simple returns a completely unuseful stringified file
+# handle as the source_filename for input from a file handle, so we have to
+# deal with that as well.
sub devise_date {
my ($self) = @_;
my $input = $self->source_filename;
- my $time = ($input ? (stat $input)[9] : time);
+ my $time;
+ if ($input) {
+ $time = (stat $input)[9] || time;
+ } else {
+ $time = time;
+ }
return strftime ('%Y-%m-%d', localtime $time);
}
.\\"
.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 = $|;
return $retval;
}
+# Pod::Simple failed to provide this backward compatibility function, so
+# implement it ourselves. File handles are one of the inputs that
+# parse_from_file supports.
+sub parse_from_filehandle {
+ my $self = shift;
+ $self->parse_from_file (@_);
+}
+
##############################################################################
# Translation tables
##############################################################################
..
.\" 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