texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Fri, 23 Dec 2022 17:11:31 -0500 (EST)

branch: master
commit 7677326ed3030090e46fec23c09eaf7ca0781207
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Dec 23 23:10:50 2022 +0100

    * tp/Texinfo/Convert/Info.pm (format_image): avoid warnings about
    undefined values with @image with alt and text but no image file.
    
    * tp/Makefile.am (test_files), tp/Makefile.tres, tp/t/info_tests.t,
    tp/t/include/text_only_image.txt: new test
    image_text_file_only_and_alt with alt and text file but no image file.
---
 ChangeLog                                               |   9 +++++++++
 tp/Makefile.am                                          |   1 +
 tp/Makefile.tres                                        |   2 ++
 tp/Texinfo/Convert/Info.pm                              |  10 +++++++---
 tp/t/info_tests.t                                       |   5 +++++
 tp/t/results/info_tests/image_text_file_only_and_alt.pl | Bin 0 -> 3370 bytes
 6 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c16c9409b2..396edb526a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-12-23  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Info.pm (format_image): avoid warnings about
+       undefined values with @image with alt and text but no image file.
+
+       * tp/Makefile.am (test_files), tp/Makefile.tres, tp/t/info_tests.t,
+       tp/t/include/text_only_image.txt: new test
+       image_text_file_only_and_alt with alt and text file but no image file.
+
 2022-12-23  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/NodeNameNormalization.pm
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 944621940f..c9d08d974a 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -149,6 +149,7 @@ test_files = \
  t/include/image_encoded.txt \
  t/include/inc_@f--ile.texi \
  t/include/included_file_with_setfilename.texi \
+ t/include/text_only_image.txt \
  t/include/this_is_a_long_unknown_file.png \
  t/include/verbatim_encoded.texi \
  t/include/verbatim_encoded_latin1.texi \
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index a9989fd3eb..2d35bdfc61 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -419,6 +419,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/float/numbering_captions_listoffloats.pl \
   t/results/float/ref_to_float.pl \
   t/results/float/simple.pl \
+  t/results/float/special_characters_in_float_type.pl \
   t/results/formats_encodings/accent.pl \
   t/results/formats_encodings/accent_enable_encoding.pl \
   t/results/formats_encodings/accentenc.pl \
@@ -827,6 +828,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/info_tests/image_not_found.pl \
   t/results/info_tests/image_quotes.pl \
   t/results/info_tests/image_text_encoded.pl \
+  t/results/info_tests/image_text_file_only_and_alt.pl \
   t/results/info_tests/index_entry_at_end_node.pl \
   t/results/info_tests/invalid_node_name_no_warning.pl \
   t/results/info_tests/invalid_node_name_warning.pl \
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 3c98e8fd04..7e419b2cc1 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -578,11 +578,15 @@ sub format_image($$)
     my $result;
 
     if (defined($image_file) or (defined($text) and defined($alt))) {
-      $image_file =~ s/\\/\\\\/g;
-      $image_file =~ s/\"/\\\"/g;
+      if (defined($image_file)) {
+        $image_file =~ s/\\/\\\\/g;
+        $image_file =~ s/\"/\\\"/g;
+      } else {
+        $image_file = '';
+      }
       $result = "\x{00}\x{08}[image src=\"$image_file\"";
 
-      if ($alt) {
+      if (defined($alt) and $alt ne '') {
         $alt =~ s/\\/\\\\/g;
         $alt =~ s/\"/\\\"/g;
         $result .= " alt=\"$alt\"";
diff --git a/tp/t/info_tests.t b/tp/t/info_tests.t
index fd1c2e5a7f..717bddfb5b 100644
--- a/tp/t/info_tests.t
+++ b/tp/t/info_tests.t
@@ -272,6 +272,11 @@ ref to anchor1@footnote{another footnote}, which is before 
@@node Top: @ref{anch
 
 @printindex cp
 
+'],
+['image_text_file_only_and_alt',
+'@node Top
+
+@image{text_only_image,,,alt}
 '],
 ['image_quotes', 
 '@node Top
diff --git a/tp/t/results/info_tests/image_text_file_only_and_alt.pl 
b/tp/t/results/info_tests/image_text_file_only_and_alt.pl
new file mode 100644
index 0000000000..74f71a3b78
Binary files /dev/null and 
b/tp/t/results/info_tests/image_text_file_only_and_alt.pl differ



reply via email to

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