texinfo-commits
[Top][All Lists]
Advanced

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

[5420] handle -D"var val" as in C makeinfo


From: karl
Subject: [5420] handle -D"var val" as in C makeinfo
Date: Fri, 14 Mar 2014 22:51:58 +0000

Revision: 5420
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5420
Author:   karl
Date:     2014-03-14 22:51:57 +0000 (Fri, 14 Mar 2014)
Log Message:
-----------
handle -D"var val" as in C makeinfo

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/texinfo.texi
    trunk/tp/texi2any.pl

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-02-25 23:42:47 UTC (rev 5419)
+++ trunk/ChangeLog     2014-03-14 22:51:57 UTC (rev 5420)
@@ -1,3 +1,11 @@
+2014-03-14  Karl Berry  <address@hidden>
+
+       * tp/texi2any.pl (D=s): handle -D 'var value', as C makeinfo did.
+       Based on bug-texinfo mail from Guo Yixuan, 4 Mar 2014 17:29:34 -0500
+        (tiny change).
+        (makeinfo_help): document it.
+        * doc/texinfo.texi (Invoking @t{texi2any}): document it.
+
 2014-02-25  Arnold Robbins  <address@hidden>
             Karl Berry  <address@hidden>
 

Modified: trunk/doc/texinfo.texi
===================================================================
--- trunk/doc/texinfo.texi      2014-02-25 23:42:47 UTC (rev 5419)
+++ trunk/doc/texinfo.texi      2014-03-14 22:51:57 UTC (rev 5420)
@@ -17160,11 +17160,17 @@
 standalone style sheets.
 
 @item -D @var{var}
address@hidden -D '@var{var} @var{value}'
 @opindex -D @var{var}
 Cause the Texinfo variable @var{var} to be defined.  This is
 equivalent to @code{@@set @var{var}} in the Texinfo file
 (@address@hidden@@set @@clear @@value}}).
 
+The argument to the option is always one word to the shell; if it
+contains internal whitespace, the first word is taken as the variable
+name and the remainder as the value.  For example, @code{-D 'myvar
+someval'} is equivalent to @code{@@set myvar someval}.
+
 @item --disable-encoding
 @itemx --enable-encoding
 @opindex --disable-encoding

Modified: trunk/tp/texi2any.pl
===================================================================
--- trunk/tp/texi2any.pl        2014-02-25 23:42:47 UTC (rev 5419)
+++ trunk/tp/texi2any.pl        2014-03-14 22:51:57 UTC (rev 5420)
@@ -806,6 +806,7 @@
   $makeinfo_help .= __("Input file options:
       --commands-in-node-names  does nothing, retained for compatibility.
   -D VAR                        define the variable VAR, as with address@hidden
+  -D 'VAR VAL'                  define VAR to VAL (one shell argument).
   -I DIR                        append DIR to the address@hidden search path.
   -P DIR                        prepend DIR to the address@hidden search path.
   -U VAR                        undefine the variable VAR, as with 
address@hidden")
@@ -924,7 +925,15 @@
                         document_warn($message);
                       }
                     },
- 'D=s' => sub {$parser_default_options->{'values'}->{$_[1]} = 1;},
+ 'D=s' => sub {
+    my $var = $_[1];
+    my @field = split (/\s+/, $var, 2);
+    if (@field == 1) {
+      $parser_default_options->{'values'}->{$var} = 1;
+    } else {
+      $parser_default_options->{'values'}->{$field[0]} = $field[1];
+    }
+ },
  'U=s' => sub {delete $parser_default_options->{'values'}->{$_[1]};},
  'init-file=s' => sub {
     locate_and_load_init_file($_[1], [ @conf_dirs, @program_init_dirs ]);




reply via email to

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