man: improve typesetting and prepare for html output

* src/bin/man/autfilt.x, src/bin/man/dstar2tgba.x,
src/bin/man/ltl2tgba.x, src/bin/man/ltlcross.x,
src/bin/man/ltlgrind.x, src/bin/man/randltl.x, src/bin/man/spot-x.x:
Improve typesetting and cross-references.
* tools/help2man: Adjust to better detect the optional arguments.
Detect options that are not separated from their description by two
spaces.  Argp output some of those.
* tools/man2html.pl: New file.
* Makefile.am: Distribute it.
* src/bin/ltlfilt.cc: Fix description of --define.
* src/bin/ltlgrind.cc: Fix duplicate description for --help and
--version.  Reorder --help output slightly.
* NEWS: Mention the few fixes.
This commit is contained in:
Alexandre Duret-Lutz 2015-08-12 19:13:45 +02:00
parent 5b75ad5abd
commit f7b65001e9
13 changed files with 290 additions and 159 deletions

View file

@ -2,7 +2,7 @@
# Generate a short man page from --help and --version output.
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009,
# 2010, 2011, 2012 Free Software Foundation, Inc.
# 2010, 2011, 2012, 2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -485,7 +485,14 @@ while (length)
my $content = '';
# Option with description.
if (s/^( {1,10}([+-]\S.*?))(?:( +(?!-))|\n( {20,}))(\S.*)\n//)
my $descrpat2 = '(?:( +(?!-))|\n( {20,}))(\S.*)\n';
my $descrpat1 = '(?:( (?!-))|\n( {20,}))(\S.*)\n';
if (s/^( {1,10}([+-]\S.*?))$descrpat2//o ||
# Cases where "-x, --option" or "--option" is separated from
# "description" by a single space, because "description" then
# starts on column 29. This is output by argp.
s/^( {2}([+-]\S.{24}))$descrpat1//o ||
s/^( {6}([+-]\S.{20}))$descrpat1//o)
{
$matched .= $& if %append;
$indent = length ($4 || "$1$3");
@ -548,7 +555,8 @@ while (length)
s/\x84//g;
# Convert options.
s/(^| |\()(-[][\w=-]+)/$1 . convert_option $2/mge;
s/(^| )(-[][\w-]+(?:=[][\w=\/|()'"-]*)?)/$1 . convert_option $2/mge;
s/\((-[][\w-]+(?:=[][\w=\/|()'"-]*)?)\)/"(" . convert_option $1 . ")"/mge;
# Escape remaining hyphens
s/-/\x83/g;
@ -682,10 +690,15 @@ sub convert_option
local $_ = '\fB' . shift;
s/-/\x83/g;
unless (s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/)
if (s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/)
{
s/\|/\\fR|\\fI/g;
}
else
{
s/=(.)/\\fR=\\fI$1/;
s/ (.)/ \\fI$1/;
s/[\[\|\]]/\\fR$&\\fI/g;
$_ .= '\fR';
}