[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: makeinfo -D doesn't work the same way as before
From: |
Patrice Dumas |
Subject: |
Re: makeinfo -D doesn't work the same way as before |
Date: |
Wed, 5 Mar 2014 15:03:11 +0100 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Tue, Mar 04, 2014 at 05:29:34PM -0500, Guo Yixuan wrote:
> Hi,
>
> In building several info files, I need to use "-D" option to define
> variables and assign values.
>
> In version <= 4.13, it works, but with newer version of texinfo, it fails.
>
> $ # this is a one-line test file
> $ cat test.texi
> @value{var1}
> $ # older version (4.13)
> $ makeinfo -v -D 'var1 foo' -o test.info test.texi
> makeinfo (GNU texinfo) 4.13
> Making info file `test.info' from `test.texi'.
> $ cat test.info
> This is test.info, produced by makeinfo version 4.13 from test.texi.
>
> foo
>
> $ # new version of makeinfo (5.2)
> $ makeinfo -v -D 'var1 foo' -o test.info test.texi
> test.texi:1: warning: undefined flag: var1
> Output file test.info
> test.texi: warning: document without nodes
> $ cat test.info
> This is test.info, produced by makeinfo version 5.2 from test.texi.
>
> {No value for 'var1'}
>
>
> Tag Table:
>
> End Tag Table
> $
>
> This patch should restore the old behavior.
>
> --- a/tp/texi2any.pl
> +++ b/tp/texi2any.pl
> @@ -924,7 +924,15 @@ There is NO WARRANTY, to the extent perm
> document_warn($message);
> }
> },
> - 'D=s' => sub {$parser_default_options->{'values'}->{$_[1]} = 1;},
> + 'D=s' => sub {
> + my $var = $_[1];
> + my @field = split /\s+/, $var;
> + 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 ]);
The analysis and patch looks good to me. Thanks!
Maybe this should be documented in the --help and texinfo manual?
Karl, would you install it?
--
Pat