texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (_get_erro


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/Parsetexi.pm (_get_errors): encode file name for consistency with file names being bytes, as a temporary measure before a better interface is implemented.
Date: Wed, 23 Feb 2022 09:26:48 -0500

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 06bda7d250 * tp/Texinfo/XS/parsetexi/Parsetexi.pm (_get_errors): 
encode file name for consistency with file names being bytes, as a temporary 
measure before a better interface is implemented.
06bda7d250 is described below

commit 06bda7d250f72ae3014d6cb5b96d26696b109ba9
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Feb 23 15:26:35 2022 +0100

    * tp/Texinfo/XS/parsetexi/Parsetexi.pm (_get_errors): encode
    file name for consistency with file names being bytes, as a temporary
    measure before a better interface is implemented.
    
    * tp/Texinfo/Report.pm: rename variables.
---
 ChangeLog                                           |   8 ++++++++
 tp/Texinfo/Report.pm                                |  20 ++++++++++----------
 tp/Texinfo/XS/parsetexi/Parsetexi.pm                |  10 ++++++++++
 tp/tests/Makefile.am                                |   2 +-
 tp/tests/formatting/Makefile.am                     |   2 +-
 "tp/tests/formatting/an_\303\257mage.png"           | Bin 0 -> 514064 bytes
 tp/tests/formatting/list-of-tests                   |   5 ++++-
 "tp/tests/formatting/os\303\251.texi"               |   8 ++++++++
 .../res_parser/non_ascii_command_line/Chapteur.html |   9 ++++++++-
 .../non_ascii_command_line/os\303\251-texinfo.texi" |   8 ++++++++
 .../res_parser/non_ascii_command_line/os\303\251.2" |   2 ++
 "tp/tests/included_ak\303\247ent\303\252d.texi"     |   1 +
 12 files changed, 61 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eed1307152..0aa8a9d706 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-02-23  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/Parsetexi.pm (_get_errors): encode
+       file name for consistency with file names being bytes, as a temporary
+       measure before a better interface is implemented.
+
+       * tp/Texinfo/Report.pm: rename variables.
+
 2022-02-22  Patrice Dumas  <pertusus@free.fr>
 
        Decode inputs for encoded characters
diff --git a/tp/Texinfo/Report.pm b/tp/Texinfo/Report.pm
index f0da4cc205..693c255b3a 100644
--- a/tp/Texinfo/Report.pm
+++ b/tp/Texinfo/Report.pm
@@ -73,14 +73,14 @@ sub line_warn($$$$)
   my $configuration_information = shift;
   my $text = shift;
   chomp ($text);
-  my $line_number = shift;
-  return if (!defined($line_number));
+  my $error_location_info = shift;
+  return if (!defined($error_location_info));
   my $warn_line;
 
-  if ($line_number->{'macro'} ne '') {
+  if ($error_location_info->{'macro'} ne '') {
     $warn_line = sprintf(__p("Texinfo source file warning",
                              "warning: %s (possibly involving \@%s)\n"),
-                         $text, $line_number->{'macro'});
+                         $text, $error_location_info->{'macro'});
   } else {
     $warn_line = sprintf(__p("Texinfo source file warning", 
                              "warning: %s\n"),
@@ -90,7 +90,7 @@ sub line_warn($$$$)
                       and $configuration_information->get_conf('DEBUG'));
   push @{$self->{'errors_warnings'}},
        { 'type' => 'warning', 'text' => $text, 'error_line' => $warn_line,
-         %{$line_number} };
+         %{$error_location_info} };
 }
 
 # format a line error
@@ -100,18 +100,18 @@ sub line_error($$$$)
   my $configuration_information = shift;
   my $text = shift;
   chomp ($text);
-  my $line_number = shift;
-  if (defined($line_number)) {
+  my $error_location_info = shift;
+  if (defined($error_location_info)) {
     my $macro_text = '';
-    $macro_text = " (possibly involving \@$line_number->{'macro'})"
-       if ($line_number->{'macro'} ne '');
+    $macro_text = " (possibly involving \@$error_location_info->{'macro'})"
+       if ($error_location_info->{'macro'} ne '');
     my $error_text = "$text$macro_text\n";
     warn $error_text if (defined($configuration_information)
                          and $configuration_information->get_conf('DEBUG'));
     push @{$self->{'errors_warnings'}},
          { 'type' => 'error', 'text' => $text,
            'error_line' => $error_text,
-           %{$line_number} };
+           %{$error_location_info} };
   }
   $self->{'error_nrs'}++;
 }
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index f6f5485a45..401fc9c8d7 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -260,6 +260,16 @@ sub _get_errors($)
   utf8::decode($tree_stream);
   eval $tree_stream;
   for my $error (@{$ERRORS}) {
+    my $error_location_info = $error->{'line_nr'};
+    if (defined($error_location_info)
+        and defined($error_location_info->{'file_name'})) {
+      # When dealing with file names, we want Perl strings representing
+      # sequences of bytes, not codepoints.
+      # FIXME this is not really correct, the final encoding may not be utf-8
+      # but this should be better handled, without decoding followed by
+      # encoding when a better interface is implemented.
+      utf8::encode($error_location_info->{'file_name'});
+    }
     if ($error->{'type'} eq 'error') {
       $registrar->line_error ($configuration_information,
                               $error->{'message'}, $error->{'line_nr'});
diff --git a/tp/tests/Makefile.am b/tp/tests/Makefile.am
index e8fc69dbe1..cff570e931 100644
--- a/tp/tests/Makefile.am
+++ b/tp/tests/Makefile.am
@@ -62,4 +62,4 @@ other-checks: all
        $(MAKE) $(AM_MAKEFLAGS) check OTHER_TESTS=yes 
TESTS='$(type_other_one_test_files_generated_list)' SUBDIRS=
 
 EXTRA_DIST = run_parser_all.sh parser_tests.sh \
- $(one_test_files_generated_list) coverage_macro.texi
+ $(one_test_files_generated_list) coverage_macro.texi included_akçentêd.texi
diff --git a/tp/tests/formatting/Makefile.am b/tp/tests/formatting/Makefile.am
index ff32fec9d7..d5cd06aad9 100644
--- a/tp/tests/formatting/Makefile.am
+++ b/tp/tests/formatting/Makefile.am
@@ -4,7 +4,7 @@ EXTRA_DIST = \
  inc_file.texi              test_need.texi \
  lightweight_markups.texi   japanese_long_name.texi  \
  osé.texi \
- çss.css cêss.css file.css list-of-tests  res_parser
+ çss.css cêss.css file.css an_ïmage.png list-of-tests  res_parser
 
 DISTCLEANFILES = tests.log tests.out
 
diff --git "a/tp/tests/formatting/an_\303\257mage.png" 
"b/tp/tests/formatting/an_\303\257mage.png"
new file mode 100644
index 0000000000..193409f6ba
Binary files /dev/null and "b/tp/tests/formatting/an_\303\257mage.png" differ
diff --git a/tp/tests/formatting/list-of-tests 
b/tp/tests/formatting/list-of-tests
index 42b635c039..f3751f1e68 100644
--- a/tp/tests/formatting/list-of-tests
+++ b/tp/tests/formatting/list-of-tests
@@ -14,6 +14,9 @@ documentlanguage_cmdline documentlanguage.texi 
--document-language=fr
 # easily tested by calling directly ./texi2any.pl and checking visually:
 # ./texi2any.pl --footnote-style=bâd
 # ./texi2any.pl --paragraph-indent=ïndent
-# check non ascii command line arguments
+# check non ascii command line arguments and css files
 non_ascii_command_line osé.texi --html --split=Mekanïk 
--document-language=Destruktïw -c 'Kommandöh vâl' -D TÛT -D 'vùr ké' -U ôndef 
-c 'FORMAT_MENU mînù' --macro-expand=@OUT_DIR@osé-texinfo.texi 
--internal-links=@OUT_DIR@intérnal.txt --css-include çss.css --css-include 
cêss.css --css-ref=rëf --css-ref=öref
 
+# test for the copying of image with non ascii characters for epub
+# to be added when it does not fail anymore
+#non_ascii_test_epub osé.texi --init epub3.pm -c 'EPUB_CREATE_CONTAINER 0'
diff --git "a/tp/tests/formatting/os\303\251.texi" 
"b/tp/tests/formatting/os\303\251.texi"
index c273904f72..db36c2c7f1 100644
--- "a/tp/tests/formatting/os\303\251.texi"
+++ "b/tp/tests/formatting/os\303\251.texi"
@@ -13,3 +13,11 @@ isset TÛT
 @end ifset
 
 value vùr @value{vùr}.
+
+@include included_akçentêd.texi
+
+@image{an_ïmage,,,öld}
+
+@image{dîrectory/imàge,,,âlt,.êxt}
+
+@include not_existïng.téxi
diff --git 
a/tp/tests/formatting/res_parser/non_ascii_command_line/Chapteur.html 
b/tp/tests/formatting/res_parser/non_ascii_command_line/Chapteur.html
index 78818eed59..98c49e654a 100644
--- a/tp/tests/formatting/res_parser/non_ascii_command_line/Chapteur.html
+++ b/tp/tests/formatting/res_parser/non_ascii_command_line/Chapteur.html
@@ -61,7 +61,14 @@ ul.mark-néni {list-style-type: "vàça"}
 <p>isset TÛT
 </p>
 <p>value vùr ké.
-</p></div>
+</p>
+<p>In included téxt.
+</p>
+<img class="image" src="an_ïmage.png" alt="öld">
+
+<img class="image" src="dîrectory/imàge.êxt" alt="âlt">
+
+</div>
 <hr>
 <p>
   <span class="program-in-footer">This document was generated on <em 
class="emph">a sunny day</em> using <a class="uref" 
href="http://www.gnu.org/software/texinfo/";><em 
class="emph">texi2any</em></a>.</span>
diff --git 
"a/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251-texinfo.texi"
 
"b/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251-texinfo.texi"
index 587bad7166..4ea951c406 100644
--- 
"a/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251-texinfo.texi"
+++ 
"b/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251-texinfo.texi"
@@ -11,3 +11,11 @@
 isset TÛT
 
 value vùr ké.
+
+In included téxt.
+
+@image{an_ïmage,,,öld}
+
+@image{dîrectory/imàge,,,âlt,.êxt}
+
+@include not_existïng.téxi
diff --git 
"a/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251.2" 
"b/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251.2"
index 3d62935143..4dbb7790d5 100644
--- "a/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251.2"
+++ "b/tp/tests/formatting/res_parser/non_ascii_command_line/os\303\251.2"
@@ -1,3 +1,5 @@
 texi2any: warning: Mekanïk is not a valid split possibility
 texi2any: warning: Destruktïw is not a valid language code
 texi2any: warning: unknown variable from command line: Kommandöh
+osé.texi:23: @include: could not find not_existïng.téxi
+osé.texi:21: warning: @image file `dîrectory/imàge' (for HTML) not found, 
using `dîrectory/imàge.êxt'
diff --git "a/tp/tests/included_ak\303\247ent\303\252d.texi" 
"b/tp/tests/included_ak\303\247ent\303\252d.texi"
new file mode 100644
index 0000000000..ca65b0c27c
--- /dev/null
+++ "b/tp/tests/included_ak\303\247ent\303\252d.texi"
@@ -0,0 +1 @@
+In included téxt.



reply via email to

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