bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

doc: avoid spurious empty lines in the option table


From: Akim Demaille
Subject: doc: avoid spurious empty lines in the option table
Date: Fri, 19 Jul 2019 16:56:34 +0200

We go from



to



and similarly in Info.

The following commit changes cross-options.texi from

> @item @option{--color[=@var{when}]}
> @tab
> @tab
> 
> @item @option{--debug}
> @tab @option{-t}
> @tab @code{%debug}
> 
> @item @option{--define=@var{name}[=@var{value}]}
> @tab @option{-D @var{name}[=@var{value}]}
> @tab @code{%define @var{name} [@var{value}]}
> 
> @item @option{--defines[=@var{file}]}
> @tab @option{-d}
> @tab @code{%defines [@var{"file"}]}
> 
> @item @option{--feature[=@var{features}]}
> @tab @option{-f [@var{features}]}
> @tab

to

> @item @option{--color[=@var{when}]}                    @tab                   
>                    @tab
> @item @option{--debug}                                 @tab @option{-t}       
>                    @tab @code{%debug}
> @item @option{--define=@var{name}[=@var{value}]}       @tab @option{-D 
> @var{name}[=@var{value}]} @tab @code{%define @var{name} [@var{value}]}
> @item @option{--defines[=@var{file}]}                  @tab @option{-d}       
>                    @tab @code{%defines [@var{"file"}]}
> @item @option{--feature[=@var{features}]}              @tab @option{-f 
> [@var{features}]}         @tab


commit 220c593a79e4b5320350ab2f7f1b54765e091666
Author: Akim Demaille <address@hidden>
Date:   Fri Jul 19 07:32:51 2019 +0200

    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.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]