doc: avoid spurious empty lines in the option table

In Texinfo. empty lines in multitable rows generate empty lines in the
output.  Avoid them altogether.

With help from Gavin Smith.
https://lists.gnu.org/archive/html/bug-texinfo/2019-07/msg00000.html

* build-aux/cross-options.pl: Separate rows with empty lines.
So, to be more readable, generate a single line for each row.
Use Perl format to this end.
This commit is contained in:
Akim Demaille
2019-07-19 07:32:51 +02:00
parent e29ac453d0
commit 220c593a79

View File

@@ -12,7 +12,7 @@ while (<STDIN>)
{ {
if (/^\s* # Initial spaces. if (/^\s* # Initial spaces.
(?:(-\w),\s+)? # $1: $short: Possible short option. (?:(-\w),\s+)? # $1: $short: Possible short option.
(--[-\w]+) # $2: $long: Long option. (--[-\w]+) # $2: $long: Mandatory long option.
(\[?) # $3: $opt: '[' iff the argument is optional. (\[?) # $3: $opt: '[' iff the argument is optional.
(?:=(\S+))? # $4: $arg: Possible argument name. (?:=(\S+))? # $4: $arg: Possible argument name.
\s # Spaces. \s # Spaces.
@@ -32,7 +32,6 @@ while (<STDIN>)
# if $opt, $arg contains the closing ]. # if $opt, $arg contains the closing ].
substr ($arg, -1) = '' substr ($arg, -1) = ''
if $opt eq '['; if $opt eq '[';
$arg =~ s/^=//;
$arg = lc ($arg); $arg = lc ($arg);
my $dir_arg = $arg; my $dir_arg = $arg;
# If the argument is complete (e.g., for --define[=NAME[=VALUE]]), # If the argument is complete (e.g., for --define[=NAME[=VALUE]]),
@@ -72,12 +71,15 @@ while (<STDIN>)
my $sep = ''; my $sep = '';
foreach my $long (sort keys %option) foreach my $long (sort keys %option)
{ {
# Avoid trailing spaces. # Couldn't find a means to escape @ in the format (for @item, @tab), so
print $sep; # pass it as a literal to print.
$sep = "\n"; format STDOUT =
print '@item @option{', $long, "}\n\@tab"; @item @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
print ' @option{', $option{$long}, '}' if $option{$long}; {
print "\n\@tab"; '@', '@option{' . $long . '}',
print ' @code{', $directive{$long}, '}' if $directive{$long}; '@', $option{$long} ? ('@option{' . $option{$long} . '}') : '',
print "\n"; '@', $directive{$long} ? ('@code{' . $directive{$long} . '}') : ''
}
.
write;
} }