[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Warn if no image file is found in LaTeX
From: |
Patrice Dumas |
Subject: |
branch master updated: Warn if no image file is found in LaTeX |
Date: |
Sat, 13 Aug 2022 17:11:16 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 7de8744a89 Warn if no image file is found in LaTeX
7de8744a89 is described below
commit 7de8744a8918b5f4d3131ba0f1a6be47f3ae7052
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 13 23:11:05 2022 +0200
Warn if no image file is found in LaTeX
* tp/Texinfo/Convert/LaTeX.pm (_convert): warn if no image file
is found, even though a file found does not modify the output.
---
ChangeLog | 7 ++
tp/Texinfo/Convert/LaTeX.pm | 40 +++++++-----
tp/t/results/converters_tests/image_extension.pl | 13 ++++
tp/t/results/converters_tests/image_formatting.pl | 76 ++++++++++++++++++++++
.../non_ascii_test_latex/os\303\251_utf8.2" | 1 +
.../res_parser/formatting_latex/formatting.2 | 20 ++++++
6 files changed, 140 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9864d327a0..fe7dfebcad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-08-13 Patrice Dumas <pertusus@free.fr>
+
+ Warn if no image file is found in LaTeX
+
+ * tp/Texinfo/Convert/LaTeX.pm (_convert): warn if no image file
+ is found, even though a file found does not modify the output.
+
2022-08-13 Patrice Dumas <pertusus@free.fr>
Do not set INDEX_SPECIAL_CHARS_WARNING with INFO_SPECIAL_CHARS_QUOTE
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 95b634c63d..6325243145 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -2505,32 +2505,38 @@ sub _convert($$)
my $basefile = Texinfo::Convert::Text::convert_to_text(
{'contents' => $element->{'args'}->[0]->{'contents'}},
{'code' => 1, %{$self->{'convert_text_options'}}});
- # FIXME not clear at all what can be in filenames here,
- # what should be escaped and how
- my $converted_basefile = $basefile;
- # for now minimal protection. Not sure that % is problematic
- $converted_basefile =~ s/([%{}\\])/\\$1/g;
- # FIXME why do that if $converted_basefile is used even if no file is
found?
- my $image_file;
+ # warn if no file is found, even though the basefile is used
+ # in any case.
+ my $image_file_found;
foreach my $extension (@LaTeX_image_extensions) {
my ($file_name, $file_name_encoding)
= $self->encoded_input_file_name("$basefile.$extension");
my $located_file =
$self->Texinfo::Common::locate_include_file($file_name);
if (defined($located_file)) {
- # use the basename and not the file found. It is agreed that it is
- # better, since in any case the files are moved.
- # If the file path found was to be used it should be decoded to
perl
- # codepoints too.
- # using basefile with escaped characters, no extension to let
LaTeX choose the
- # extension
- $image_file = $converted_basefile;
+ $image_file_found = 1;
+ last;
}
}
- if (not defined($image_file)) {
- $image_file = $converted_basefile;
- }
+ if (not $image_file_found) {
+ $self->line_warn($self,
+ sprintf(__("\@image file `%s' (for LaTeX) not found"),
+ $basefile),
+ $element->{'source_info'});
+ }
+ # Use the basename and not the file found. It is agreed that it is
+ # better, since in any case the files are moved.
+ # If the file path found was to be used it should be decoded to perl
+ # codepoints too.
+ # using basefile with escaped characters, no extension to let LaTeX
+ # choose the extension
+ # FIXME not clear at all what can be in filenames here,
+ # what should be escaped and how
+ my $converted_basefile = $basefile;
+ # for now minimal protection. Not sure that % is problematic
+ $converted_basefile =~ s/([%{}\\])/\\$1/g;
+ my $image_file = $converted_basefile;
my $width;
if ((@{$element->{'args'}} >= 2)
and defined($element->{'args'}->[1])
diff --git a/tp/t/results/converters_tests/image_extension.pl
b/tp/t/results/converters_tests/image_extension.pl
index 7694c2b70a..6e6ce5b491 100644
--- a/tp/t/results/converters_tests/image_extension.pl
+++ b/tp/t/results/converters_tests/image_extension.pl
@@ -154,6 +154,19 @@ $result_converted_errors{'docbook'}->{'image_extension'} =
[
$result_converted{'latex'}->{'image_extension'} = '\\includegraphics{f---ile}
';
+$result_converted_errors{'latex'}->{'image_extension'} = [
+ {
+ 'error_line' => 'warning: @image file `f---ile\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@image file `f---ile\' (for LaTeX) not found',
+ 'type' => 'warning'
+ }
+];
+
+
$result_converted{'info'}->{'image_extension'} = 'This is , produced from .
diff --git a/tp/t/results/converters_tests/image_formatting.pl
b/tp/t/results/converters_tests/image_formatting.pl
index 67622076b8..f48fd40b22 100644
--- a/tp/t/results/converters_tests/image_formatting.pl
+++ b/tp/t/results/converters_tests/image_formatting.pl
@@ -3054,6 +3054,82 @@ in para
\\includegraphics{f--ile}.
';
+$result_converted_errors{'latex'}->{'image_formatting'} = [
+ {
+ 'error_line' => 'warning: @image file `f-ile\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 13,
+ 'macro' => '',
+ 'text' => '@image file `f-ile\' (for LaTeX) not found',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @image file `f--ile@.\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 14,
+ 'macro' => '',
+ 'text' => '@image file `f--ile@.\' (for LaTeX) not found',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @image file `image\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 15,
+ 'macro' => '',
+ 'text' => '@image file `image\' (for LaTeX) not found',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @image file `image\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 15,
+ 'macro' => '',
+ 'text' => '@image file `image\' (for LaTeX) not found',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @image file `f-ile\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 24,
+ 'macro' => '',
+ 'text' => '@image file `f-ile\' (for LaTeX) not found',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @image file `f--ile@.\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 25,
+ 'macro' => '',
+ 'text' => '@image file `f--ile@.\' (for LaTeX) not found',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @image file `image\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 26,
+ 'macro' => '',
+ 'text' => '@image file `image\' (for LaTeX) not found',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @image file `image\' (for LaTeX) not found
+',
+ 'file_name' => '',
+ 'line_nr' => 26,
+ 'macro' => '',
+ 'text' => '@image file `image\' (for LaTeX) not found',
+ 'type' => 'warning'
+ }
+];
+
+
$result_converted{'info'}->{'image_formatting'} = 'This is , produced from .
diff --git
"a/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.2"
"b/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.2"
index 9a23292a72..5fc05566ac 100644
--- "a/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.2"
+++ "b/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.2"
@@ -1,3 +1,4 @@
osé_utf8.texi:15: warning: undefined flag: vùr
osé_utf8.texi:24: @include: could not find not_existïng.téxi
+osé_utf8.texi:22: warning: @image file `dîrectory/imàge' (for LaTeX) not found
osé_utf8.texi:28: @verbatiminclude: could not find vi_not_existïng.téxi
diff --git a/tp/tests/layout/res_parser/formatting_latex/formatting.2
b/tp/tests/layout/res_parser/formatting_latex/formatting.2
index 48f2caf921..4dbf51be79 100644
--- a/tp/tests/layout/res_parser/formatting_latex/formatting.2
+++ b/tp/tests/layout/res_parser/formatting_latex/formatting.2
@@ -291,3 +291,23 @@ formatting.texi:73: @ref reference to nonexistent node
`node' (possibly involvin
formatting.texi:73: @ref reference to nonexistent node `node' (possibly
involving @mymacro)
formatting.texi:73: @ref reference to nonexistent node `node' (possibly
involving @mymacro)
formatting.texi:73: @ref reference to nonexistent node `node' (possibly
involving @mymacro)
+formatting.texi:32: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:32: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:32: warning: @image file `f--ile@.' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:32: warning: @image file `filejk _" %@' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `f--ile@.' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `filejk _" %@' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `f--ile@.' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:22: warning: @image file `filejk _" %@' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:68: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:68: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:68: warning: @image file `f--ile@.' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:68: warning: @image file `filejk _" %@' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:73: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:73: warning: @image file `f-ile' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:73: warning: @image file `f--ile@.' (for LaTeX) not found
(possibly involving @mymacro)
+formatting.texi:73: warning: @image file `filejk _" %@' (for LaTeX) not found
(possibly involving @mymacro)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Warn if no image file is found in LaTeX,
Patrice Dumas <=