From c4d7026cf9f567c3098fcf49cf13fa17f9d42515 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 10 Nov 1999 06:14:12 +0000 Subject: import 1.019 --- man/help2man | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'man') diff --git a/man/help2man b/man/help2man index c3d80ea2d..109547c55 100755 --- a/man/help2man +++ b/man/help2man @@ -27,7 +27,7 @@ use Text::Tabs qw(expand); use POSIX qw(strftime setlocale LC_TIME); my $this_program = 'help2man'; -my $this_version = '1.018'; +my $this_version = '1.019'; my $version_info = </dev/null` - or die "$this_program: can't get `--help' info from $ARGV[0]\n"; - -my $version_text = join '', map { expand $_ } `$ARGV[0] --version 2>/dev/null` - or die "$this_program: can't get `--version' info from $ARGV[0]\n"; +my ($help_text, $version_text) = map { + join '', map { s/ +$//; expand $_ } `$ARGV[0] --$_ 2>/dev/null` + or die "$this_program: can't get `--$_' info from $ARGV[0]\n" +} qw(help version); my $date = strftime "%B %Y", localtime; (my $program = $ARGV[0]) =~ s!.*/!!; @@ -359,23 +358,28 @@ while (length) my $indent = 0; my $content = ''; - # Tagged paragraph (option). - if (s/^( {1,10}(-\S+(?: \S+|(?:, *-\S+)*)))(?: +|\n( {20,}))(\S.*)\n//) + # Option with description. + if (s/^( {1,10}([+-]\S.*?))(?:( +)|\n( {20,}))(\S.*)\n//) { $matched .= $& if %append; - $indent = length ($3 || $1); - my $tag = $2; - my $desc = $4; - unless ($3) + $indent = length ($4 || "$1$3"); + $content = ".TP\n\x82$2\n\x82$5\n"; + unless ($4) { - $indent = length $1; - $indent = length $1 if /^( {20,})[^\s-]/; + # Indent may be different on second line. + $indent = length $& if /^ {20,}/; } + } - $content = ".TP\n\x82$tag\n\x82$desc\n"; + # Option without description. + elsif (s/^ {1,10}([+-]\S.*)\n//) + { + $matched .= $& if %append; + $content = ".HP\n\x82$1\n"; + $indent = 80; # not continued } - # Tagged paragraph (other). + # Indented paragraph with tag. elsif (s/^( +(\S.*?) +)(\S.*)\n//) { $matched .= $& if %append; -- cgit v1.2.3-54-g00ecf