bug-texinfo
[Top][All Lists]
Advanced

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

Re: Texinfo::Convert::HTML_convert_image_command bug


From: Patrice Dumas
Subject: Re: Texinfo::Convert::HTML_convert_image_command bug
Date: Thu, 14 Oct 2021 10:33:14 +0200

On Thu, Oct 14, 2021 at 12:25:40AM -0700, wlharvey4@mac.com wrote:
> sub _convert_image_command has a couple of bugs.
> 
> There are a couple of lines that assign to $image_file the concatenation 
> $basefile.$extension.  However, the concatenation needs to be quoted; e.g.  
> $image_file = “$basefile.$extension”.  Otherwise it is a concatenation of two 
> strings without the dot, and produces an error: e.g. when $basefile := abc, 
> and $extension := svg, then the $image_file := “abcsvg", instead of the 
> intended “abc.svg”.

The extension should be included in the @image @-command argument, from
the manual:

   * For Info and HTML output, 'makeinfo' uses the optional fifth
     argument EXTENSION to '@image' for the file extension, if it is
     specified and the file is found.  Any leading period should be
     included in EXTENSION.  For example:

          @image{foo,,,,.xpm}

The line numbers have changed, but I think that the code is the
following code. Both "$extension" and ".$extension" are used, the first
one having a leading dot included if the user follows the documentation, 
the second one in case the user provided an extension without leading
dot.  Note that if a file is found it is used, so it may happen that
"abcsvg" is used as you said, but only if the user did not provide a
leading dot as the user should have.

    my $extension;
    if (defined($args->[4]) and defined($args->[4]->{'monospacetext'})) {
      $extension = $args->[4]->{'monospacetext'};
      unshift @extensions, ("$extension", ".$extension");
    }
    my $image_file;
    foreach my $extension (@extensions) {
      if ($self->Texinfo::Common::locate_include_file ($basefile.$extension)) {
        # use the basename and not the file found.  It is agreed that it is
        # better, since in any case the files are moved.
        $image_file = $basefile.$extension;
        last;
      }
    }
    if (!defined($image_file) or $image_file eq '') {
      if (defined($extension) and $extension ne '') {
        $image_file = $basefile.$extension;
      } else {
        $image_file = "$basefile.jpg";
      }
      #cluck "err ($self->{'ignore_notice'})";
      $self->_noticed_line_warn(sprintf(
              __("\@image file `%s' (for HTML) not found, using `%s'"),
                               $basefile, $image_file), $command->{'line_nr'});
    }

-- 
Pat



reply via email to

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