# Pod::Man -- Convert POD data to formatted *roff input.
-# $Id: Man.pm,v 1.7 2000/09/03 09:22:57 eagle Exp $
+# $Id: Man.pm,v 1.8 2000/10/10 02:14:31 eagle Exp $
#
# Copyright 1999, 2000 by Russ Allbery <rra@stanford.edu>
#
# 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 = 1.07;
+$VERSION = 1.08;
############################################################################
.\}
.rm #[ #] #H #V #F C
----END OF PREAMBLE----
-
+#`# for cperl-mode
+
# This table is taken nearly verbatim from Tom Christiansen's pod2man. It
# assumes that the standard preamble has already been printed, since that's
# what defines all of the accent marks. Note that some of these are quoted
s/^([.\'\\])/\\&$1/mg;
$_;
}
-
+
# Given a command and a single argument that may or may not contain double
# quotes, handle double-quote formatting for it. If there are no double
# quotes, just return the command followed by the argument in double quotes.
# Translate a font string into an escape.
sub toescape { (length ($_[0]) > 1 ? '\f(' : '\f') . $_[0] }
-
+
############################################################################
# Initialization
############################################################################
}
# Figure out what quotes we'll be using for C<> text.
- $$self{quotes} ||= "'";
+ $$self{quotes} ||= '"';
if ($$self{quotes} eq 'none') {
$$self{LQUOTE} = $$self{RQUOTE} = '';
} elsif (length ($$self{quotes}) == 1) {
$$self{INDENT} = 0; # Current indentation level.
$$self{INDENTS} = []; # Stack of indentations.
$$self{INDEX} = []; # Index keys waiting to be printed.
+ $$self{ITEMS} = 0; # The number of consecutive =items.
$self->SUPER::initialize;
}
$self->$command (@_);
} else {
my ($text, $line, $paragraph) = @_;
- my ($file, $line) = $paragraph->file_line;
+ my $file;
+ ($file, $line) = $paragraph->file_line;
$text =~ s/\n+\z//;
$text = " $text" if ($text =~ /^\S/);
warn qq($file:$line: Unknown command paragraph "=$command$text"\n);
1 while s/^(.*?)(\t+)/$1 . ' ' x (length ($2) * 8 - length ($1) % 8)/me;
s/\\/\\e/g;
s/^(\s*\S)/'\&' . $1/gme;
- $self->makespace if $$self{NEEDSPACE};
+ $self->makespace;
$self->output (".Vb $lines\n$_.Ve\n");
$$self{NEEDSPACE} = 0;
}
>
(
,?\s+(and\s+)? # Allow lots of them, conjuncted.
- L<
+ L<
/
( [:\w]+ ( \(\) )? )
>
# scalars as well as scalars and does the right thing with them.
$text = $self->parse ($text, @_);
$text =~ s/\n\s*$/\n/;
- $self->makespace if $$self{NEEDSPACE};
+ $self->makespace;
$self->output (protect $self->mapfonts ($text));
$self->outindex;
$$self{NEEDSPACE} = 1;
my $tmp = $self->buildlink ($_);
return bless \ "$tmp", 'Pod::Man::String';
}
-
+
# Whitespace protection replaces whitespace with "\ ".
if ($command eq 'S') {
s/\s+/\\ /g;
local $_ = $self->parse (@_);
s/\s+$//;
s/\\s-?\d//g;
+ if ($$self{ITEMS} > 1) {
+ $$self{ITEMS} = 0;
+ $self->output (".PD\n");
+ }
$self->output (switchquotes ('.SH', $self->mapfonts ($_)));
$self->outindex (($_ eq 'NAME') ? () : ('Header', $_));
$$self{NEEDSPACE} = 0;
my $self = shift;
local $_ = $self->parse (@_);
s/\s+$//;
+ if ($$self{ITEMS} > 1) {
+ $$self{ITEMS} = 0;
+ $self->output (".PD\n");
+ }
$self->output (switchquotes ('.Sh', $self->mapfonts ($_)));
$self->outindex ('Subsection', $_);
$$self{NEEDSPACE} = 0;
$$self{WEIRDINDENT} = 0;
}
$_ = $self->mapfonts ($_);
+ $self->output (".PD 0\n") if ($$self{ITEMS} == 1);
$self->output (switchquotes ('.Ip', $_, $$self{INDENT}));
$self->outindex ($index ? ('Item', $index) : ());
$$self{NEEDSPACE} = 0;
+ $$self{ITEMS}++;
}
# Begin a block for a particular translator. Setting VERBATIM triggers
$self->parse_text ({ -expand_seq => 'sequence',
-expand_ptree => 'collapse' }, @_);
}
-
+
# Takes a parse tree and a flag saying whether or not to treat it as literal
# text (not call guesswork on it), and returns the concatenation of all of
# the text strings in that parse tree. If the literal flag isn't true,
# Make vertical whitespace.
sub makespace {
my $self = shift;
- $self->output ($$self{INDENT} > 0 ? ".Sp\n" : ".PP\n");
+ $self->output (".PD\n") if ($$self{ITEMS} > 1);
+ $$self{ITEMS} = 0;
+ $self->output ($$self{INDENT} > 0 ? ".Sp\n" : ".PP\n")
+ if $$self{NEEDSPACE};
}
# Output any pending index entries, and optionally an index entry given as
# Pod::Text -- Convert POD data to formatted ASCII text.
-# $Id: Text.pm,v 2.5 2000/09/03 09:23:29 eagle Exp $
+# $Id: Text.pm,v 2.6 2000/10/10 02:13:17 eagle Exp $
#
# Copyright 1999, 2000 by Russ Allbery <rra@stanford.edu>
#
# 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.05;
+$VERSION = 2.06;
############################################################################
'quot' => '"', # double quote
'sol' => '/', # solidus (forward slash)
'verbar' => '|', # vertical bar
-
+
"Aacute" => "\xC1", # capital A, acute accent
"aacute" => "\xE1", # small a, acute accent
"Acirc" => "\xC2", # capital A, circumflex accent
"eth" => "\xF0", # small eth, Icelandic
"Euml" => "\xCB", # capital E, dieresis or umlaut mark
"euml" => "\xEB", # small e, dieresis or umlaut mark
- "Iacute" => "\xCD", # capital I, acute accent
- "iacute" => "\xED", # small i, acute accent
+ "Iacute" => "\xCC", # capital I, acute accent
+ "iacute" => "\xEC", # small i, acute accent
"Icirc" => "\xCE", # capital I, circumflex accent
"icirc" => "\xEE", # small i, circumflex accent
"Igrave" => "\xCD", # capital I, grave accent
"Yacute" => "\xDD", # capital Y, acute accent
"yacute" => "\xFD", # small y, acute accent
"yuml" => "\xFF", # small y, dieresis or umlaut mark
-
+
"laquo" => "\xAB", # left pointing double angle quotation mark
"lchevron" => "\xAB", # synonym (backwards compatibility)
"raquo" => "\xBB", # right pointing double angle quotation mark
$self->$command (@_);
} else {
my ($text, $line, $paragraph) = @_;
- my ($file, $line) = $paragraph->file_line;
+ my $file;
+ ($file, $line) = $paragraph->file_line;
$text =~ s/\n+\z//;
$text = " $text" if ($text =~ /^\S/);
warn qq($file:$line: Unknown command paragraph "=$command$text"\n);
>
(
,?\s+(and\s+)? # Allow lots of them, conjuncted.
- L<
+ L<
/
(
[:\w]+
my $self = shift;
$$self{EXCLUDE} = 0;
$$self{VERBATIM} = 0;
-}
+}
# One paragraph for a particular translator. Ignore it unless it's intended
# for text, in which case we treat it as a verbatim text block.