texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Common.pm (element_associated_proces


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm (element_associated_processing_encoding): rename element_extra_encoding_for_perl as element_associated_processing_encoding. Update callers.
Date: Fri, 28 Jul 2023 16:03:10 -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 b729dfb8c2 * tp/Texinfo/Common.pm 
(element_associated_processing_encoding): rename 
element_extra_encoding_for_perl as element_associated_processing_encoding.  
Update callers.
b729dfb8c2 is described below

commit b729dfb8c288090370c5d0a177f6d61190c33402
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jul 28 22:02:54 2023 +0200

    * tp/Texinfo/Common.pm (element_associated_processing_encoding):
    rename element_extra_encoding_for_perl as
    element_associated_processing_encoding.  Update callers.
---
 ChangeLog                       |  6 ++++++
 tp/Texinfo/Common.pm            | 11 ++++++++---
 tp/Texinfo/Convert/Converter.pm | 22 +++++++++++-----------
 tp/Texinfo/Convert/IXIN.pm      |  8 ++++----
 tp/Texinfo/Convert/Text.pm      |  2 +-
 tp/Texinfo/Convert/Utils.pm     |  8 ++++----
 6 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e21080456..c2ba52bf90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-28  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (element_associated_processing_encoding):
+       rename element_extra_encoding_for_perl as
+       element_associated_processing_encoding.  Update callers.
+
 2023-07-28  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm (%non_formatted_brace_commands): add sortas.
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index f9d4bdfca0..c34a574c39 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -968,7 +968,7 @@ sub get_perl_encoding($$$)
   my $result;
   if (defined($commands_info->{'documentencoding'})) {
     foreach my $element (@{$commands_info->{'documentencoding'}}) {
-      my $perl_encoding = element_extra_encoding_for_perl($element);
+      my $perl_encoding = element_associated_processing_encoding($element);
       if (!defined($perl_encoding)) {
         my $encoding = $element->{'extra'}->{'input_encoding_name'}
           if ($element->{'extra'});
@@ -1284,8 +1284,7 @@ sub parse_node_manual($;$)
 
 # misc functions used in diverse contexts and useful in converters
 
-# FIXME document
-sub element_extra_encoding_for_perl($)
+sub element_associated_processing_encoding($)
 {
   my $element = shift;
 
@@ -2823,6 +2822,12 @@ to the @-commands names specified in the 
I<$commands_list> found
 in I<$tree> by traversing the tree.  The order of the @-commands
 should be kept.
 
+=item $encoding_name = element_associated_processing_encoding($element)
+X<C<element_associated_processing_encoding>>
+
+Returns the encoding name that can be used for decoding derived
+from the encoding that was set where I<$element> appeared.
+
 =item $result = element_is_inline($element, $check_current)
 X<C<element_is_inline>>
 
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 6f00350094..c514beba2b 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1210,10 +1210,10 @@ sub txt_image_text($$$)
   } else {
     my $filehandle = do { local *FH };
     if (open ($filehandle, $txt_file)) {
-      my $perl_encoding
-               = Texinfo::Common::element_extra_encoding_for_perl($element);
-      if (defined($perl_encoding)) {
-        binmode($filehandle, ":encoding($perl_encoding)");
+      my $encoding
+          = Texinfo::Common::element_associated_processing_encoding($element);
+      if (defined($encoding)) {
+        binmode($filehandle, ":encoding($encoding)");
       }
       my $result = '';
       my $max_width = 0;
@@ -1225,21 +1225,21 @@ sub txt_image_text($$$)
         $result .= $_;
       }
       if (!close ($filehandle)) {
-        my $decoded_file = $txt_file;
-        $decoded_file = Encode::decode($file_name_encoding, $txt_file)
+        my $decoded_file_name = $txt_file;
+        $decoded_file_name = Encode::decode($file_name_encoding, $txt_file)
           if (defined($file_name_encoding));
         $self->document_warn($self,
            sprintf(__("error on closing image text file %s: %s"),
-                                     $decoded_file, $!));
+                                     $decoded_file_name, $!));
       }
       return $result, $max_width;
     } else {
-      my $decoded_file = $txt_file;
-      $decoded_file = Encode::decode($file_name_encoding, $txt_file)
+      my $decoded_file_name = $txt_file;
+      $decoded_file_name = Encode::decode($file_name_encoding, $txt_file)
         if (defined($file_name_encoding));
       $self->line_warn($self,
-                  sprintf(__("\@image file `%s' unreadable: %s"),
-                             $decoded_file, $!), $element->{'source_info'});
+               sprintf(__("\@image file `%s' unreadable: %s"),
+                          $decoded_file_name, $!), $element->{'source_info'});
     }
   }
   return undef, undef;
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index c6cc771c9f..1c6c780614 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -920,10 +920,10 @@ sub output_ixin($$)
           if (open ($filehandle, $file)) {
             $blob_nr++;
             if ($extension eq 'txt') {
-              my $perl_encoding
-                 = Texinfo::Common::element_extra_encoding_for_perl($command);
-              if (defined($perl_encoding)) {
-                binmode($filehandle, ":encoding($perl_encoding)");
+              my $encoding
+                 = 
Texinfo::Common::element_associated_processing_encoding($command);
+              if (defined($encoding)) {
+                binmode($filehandle, ":encoding($encoding)");
               }
             }
             my $file_content;
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index ce3b6c8c08..6a0d67ca58 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -734,7 +734,7 @@ sub converter($)
              = $element->{'extra'}->{'input_encoding_name'};
           # can be undef
           $converter->{'OUTPUT_PERL_ENCODING'}
-             = Texinfo::Common::element_extra_encoding_for_perl($element);
+             = 
Texinfo::Common::element_associated_processing_encoding($element);
         }
       }
     }
diff --git a/tp/Texinfo/Convert/Utils.pm b/tp/Texinfo/Convert/Utils.pm
index 7f28daa984..56b340e9e3 100644
--- a/tp/Texinfo/Convert/Utils.pm
+++ b/tp/Texinfo/Convert/Utils.pm
@@ -240,11 +240,11 @@ sub expand_verbatiminclude($$$)
   my $file_name_text = $current->{'extra'}->{'text_arg'};
 
   my $input_encoding
-         = Texinfo::Common::element_extra_encoding_for_perl($current);
+    = Texinfo::Common::element_associated_processing_encoding($current);
 
   my ($file_name, $file_name_encoding)
-      = encoded_input_file_name($customization_information,
-                                $file_name_text, $input_encoding);
+    = encoded_input_file_name($customization_information,
+                              $file_name_text, $input_encoding);
 
   my $file = Texinfo::Common::locate_include_file($customization_information,
                                                   $file_name);
@@ -264,7 +264,7 @@ sub expand_verbatiminclude($$$)
       }
     } else {
       if (defined($input_encoding)) {
-        binmode(VERBINCLUDE, ":encoding(" . $input_encoding . ")");
+        binmode(VERBINCLUDE, ":encoding($input_encoding)");
       }
       $verbatiminclude = { 'cmdname' => 'verbatim',
                            'parent' => $current->{'parent'},



reply via email to

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