From: Gurusamy Sarathy Date: Fri, 17 Mar 2000 03:04:33 +0000 (+0000) Subject: pod{man,text} updates from podlators-1.00 (from Russ Allbery) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=46bce7d0f6ca5cc2160478e0e4f69c9cd90d1803;p=p5sagit%2Fp5-mst-13.2.git pod{man,text} updates from podlators-1.00 (from Russ Allbery) p4raw-id: //depot/perl@5770 --- diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm index 3ba26a3..11601e5 100644 --- a/lib/Pod/Man.pm +++ b/lib/Pod/Man.pm @@ -1,5 +1,5 @@ # Pod::Man -- Convert POD data to formatted *roff input. -# $Id: Man.pm,v 1.0 2000/03/06 10:16:31 eagle Exp $ +# $Id: Man.pm,v 1.1 2000/03/16 22:00:36 eagle Exp $ # # Copyright 1999, 2000 by Russ Allbery # @@ -38,7 +38,7 @@ use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION); # 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.00; +$VERSION = 1.01; ############################################################################ @@ -669,11 +669,14 @@ sub cmd_back { # An individual list item. Emit an index entry for anything that's # interesting, but don't emit index entries for things like bullets and # numbers. rofficate bullets too while we're at it (so for nice output, use -# * for your lists rather than o or . or - or some other thing). +# * for your lists rather than o or . or - or some other thing). Newlines +# in an item title are turned into spaces since *roff can't handle them +# embedded. sub cmd_item { my $self = shift; local $_ = $self->parse (@_); s/\s+$//; + s/\s*\n\s*/ /g; my $index; if (/\w/ && !/^\w[.\)]\s*$/) { $index = $_; diff --git a/pod/pod2man.PL b/pod/pod2man.PL index 4312e9f..bf35cff 100644 --- a/pod/pod2man.PL +++ b/pod/pod2man.PL @@ -36,14 +36,12 @@ $Config{startperl} print OUT <<'!NO!SUBS!'; # pod2man -- Convert POD data to formatted *roff input. +# $Id: pod2man.PL,v 1.2 2000/03/16 21:08:23 eagle Exp $ # -# Copyright 1999 by Russ Allbery +# Copyright 1999, 2000 by Russ Allbery # # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. -# -# The driver script for Pod::Man. This script is expected to eventually -# replace pod2man in the standard Perl distribution. require 5.004; @@ -52,12 +50,17 @@ use Pod::Man (); use Pod::Usage qw(pod2usage); use strict; -use vars; + +# Insert -- into @ARGV before any single dash argument to hide it from +# Getopt::Long; we want to interpret it as meaning stdin (which Pod::Parser +# does correctly). +my $stdin; +@ARGV = map { $_ eq '-' && !$stdin++ ? ('--', $_) : $_ } @ARGV; # Parse our options, trying to retain backwards compatibility with pod2man # but allowing short forms as well. --lax is currently ignored. my %options; -Getopt::Long::config ('bundling'); +Getopt::Long::config ('bundling_override'); GetOptions (\%options, 'section|s=s', 'release|r=s', 'center|c=s', 'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s', 'fixedbolditalic=s', 'official|o', 'lax|l', 'help|h') or exit 1; @@ -80,13 +83,13 @@ pod2man - Convert POD data to formatted *roff input =head1 SYNOPSIS -pod2txt [B<--section>=I] [B<--release>=I] +pod2man [B<--section>=I] [B<--release>=I] [B<--center>=I] [B<--date>=I] [B<--fixed>=I] [B<--fixedbold>=I] [B<--fixeditalic>=I] [B<--fixedbolditalic>=I] [B<--official>] [B<--lax>] [I [I]] -pod2txt B<--help> +pod2man B<--help> =head1 DESCRIPTION @@ -320,11 +323,11 @@ functions. =item ERRORS -Exceptions, error return codes, exit stati, and errno settings. Typically -used for function documentation; program documentation uses DIAGNOSTICS -instead. The general rule of thumb is that errors printed to STDOUT or -STDERR and intended for the end user are documented in DIAGNOSTICS while -errors passed internal to the calling program and intended for other +Exceptions, error return codes, exit statuses, and errno settings. +Typically used for function documentation; program documentation uses +DIAGNOSTICS instead. The general rule of thumb is that errors printed to +STDOUT or STDERR and intended for the end user are documented in DIAGNOSTICS +while errors passed internal to the calling program and intended for other programmers are documented in ERRORS. When documenting a function that sets errno, a full list of the possible errno values should be given here. @@ -463,6 +466,7 @@ page, are taken from the B documentation by Tom. =cut !NO!SUBS! +#'# (cperl-mode) close OUT or die "Can't close $file: $!"; chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; diff --git a/pod/pod2text.PL b/pod/pod2text.PL index 79cf8b2..c5460ae 100644 --- a/pod/pod2text.PL +++ b/pod/pod2text.PL @@ -37,7 +37,7 @@ print OUT <<'!NO!SUBS!'; # pod2text -- Convert POD data to formatted ASCII text. # -# Copyright 1999 by Russ Allbery +# Copyright 1999, 2000 by Russ Allbery # # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. @@ -52,7 +52,6 @@ use Pod::Text (); use Pod::Usage qw(pod2usage); use strict; -use vars qw($ID); # Take an initial pass through our options, looking for one of the form # -. We turn that into -w for compatibility with the @@ -64,14 +63,19 @@ for (my $i = 0; $i < @ARGV; $i++) { } } +# Insert -- into @ARGV before any single dash argument to hide it from +# Getopt::Long; we want to interpret it as meaning stdin (which Pod::Parser +# does correctly). +my $stdin; +@ARGV = map { $_ eq '-' && !$stdin++ ? ('--', $_) : $_ } @ARGV; + # Parse our options. Use the same names as Pod::Text for simplicity, and # default to sentence boundaries turned off for compatibility. my %options; -$options{termcap} = -t STDOUT; $options{sentence} = 0; Getopt::Long::config ('bundling'); GetOptions (\%options, 'alt|a', 'color|c', 'help|h', 'indent|i=i', - 'loose|l', 'sentence|s', 'termcap|t!', 'width|w=i') or exit 1; + 'loose|l', 'sentence|s', 'termcap|t', 'width|w=i') or exit 1; pod2usage (1) if $options{help}; # Figure out what formatter we're going to use. -c overrides -t. @@ -114,10 +118,6 @@ code). If I isn't given, it defaults to STDIN. I, if given, is the file to which to write the formatted output. If I isn't given, the formatted output is written to STDOUT. -B defaults to trying to use Pod::Text::Termcap if STDOUT is a tty. -To explicitly say not to attempt termcap escape sequences, use -B<--notermcap>. - =head1 OPTIONS =over 4 @@ -160,9 +160,9 @@ Try to determine the width of the screen and the bold and underline sequences for the terminal from termcap, and use that information in formatting the output. Output will be wrapped at two columns less than the width of your terminal device. Using this option requires that your system -have a termcap file somewhere where Term::Cap can find it. With this -option, the output of B will contain terminal control sequences -for your current terminal type. +have a termcap file somewhere where Term::Cap can find it and requires that +your system support termios. With this option, the output of B +will contain terminal control sequences for your current terminal type. =item B<-w>, B<--width=>I, B<->I