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: wlharvey4
Subject: Re: Texinfo::Convert::HTML_convert_image_command bug
Date: Thu, 14 Oct 2021 09:24:14 -0700

Pat,
Thank you for that explanation.  As a little context, I obtained the texinfo 
file from compiling an Org-mode file, and noticed that when makeinfo was run 
using a relative path pointing to the image file, the info file had a different 
answer depending on whether makeinfo could find the image or not.  If it found 
the image, then it produced a filename with a dot between the basename and the 
extension, but if it did not find the image, it reported an error, but 
nevertheless produced a filename without a dot between the base name and the 
extension (in the makeinfo file).  That is why I thought it was a bug, because  
it seems to me that makeinfo should produce the same filename regardless of 
whether it found the image or not.  Perhaps the Org backend is not producing a 
correct conversion, but the problem seemed to be an inconsistent result from 
makeinfo.

Regards,
wlharvey4

> On Oct 14, 2021, at 1:33 AM, Patrice Dumas <pertusus@free.fr> wrote:
> 
> 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]