texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/init/highlight_syntax.pm: encode/decode file


From: Patrice Dumas
Subject: branch master updated: * tp/init/highlight_syntax.pm: encode/decode files.
Date: Sun, 07 Aug 2022 04:18:17 -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 cc3c6424d0 * tp/init/highlight_syntax.pm: encode/decode files.
cc3c6424d0 is described below

commit cc3c6424d064a476f0cc163a521f3049def2dec0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 7 10:16:21 2022 +0200

    * tp/init/highlight_syntax.pm: encode/decode files.
---
 ChangeLog                   |  4 ++++
 tp/init/highlight_syntax.pm | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b1a3f7f8f6..66a9a3a842 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
        \subsection{\texttt{@float} [\textsl{type}][,\textsl{label}]}
        led to mangled output, even though the [ and ] were inside { and }.
 
+2022-08-06  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/init/highlight_syntax.pm: encode/decode files.
+
 2022-08-06  Patrice Dumas  <pertusus@free.fr>
 
        @url/@uref url independent of output encoding in HTML
diff --git a/tp/init/highlight_syntax.pm b/tp/init/highlight_syntax.pm
index 0452f9b6e6..64f28d41a4 100644
--- a/tp/init/highlight_syntax.pm
+++ b/tp/init/highlight_syntax.pm
@@ -27,10 +27,12 @@ use Texinfo::Convert::NodeNameNormalization;
 
 my %languages_name_mapping = (
   'C++' => 'C',
+  'Perl' => 'perl',
 );
 
 my %languages_extensions = (
   'texinfo' => 'texi',
+  'perl' => 'pl',
 );
 
 texinfo_add_valid_customization_option('HIGHLIGHT_SYNTAX_DEFAULT');
@@ -195,6 +197,11 @@ sub highlight_process($$)
                                       $input_language_path_name, $!));
       return 0;
     }
+    my $output_encoding;
+    if (defined($self->get_conf('OUTPUT_PERL_ENCODING'))) {
+      $output_encoding = $self->get_conf('OUTPUT_PERL_ENCODING');
+      binmode(HIGHLIGHT_LANG_IN, ":encoding($output_encoding)");
+    }
 
     print HIGHLIGHT_LANG_IN "Automatically generated\n\n";
     my $highlight_lang_in_line_nr = 2;
@@ -214,7 +221,7 @@ sub highlight_process($$)
         pop @{$tree->{'contents'}};
       }
       my $text = Texinfo::Convert::Text::convert_to_text($tree, {'code' => 1,
-                  
Texinfo::Convert::Text::copy_options_for_convert_text($self)});
+                  Texinfo::Convert::Text::copy_options_for_convert_text($self, 
1)});
       # make sure that the text ends with a newline
       chomp ($text);
       $text .= "\n";
@@ -264,6 +271,8 @@ sub highlight_process($$)
                                   $html_result_path_name, $!));
       return 0;
     }
+    binmode(HIGHLIGHT_LANG_OUT, ":encoding($output_encoding)")
+      if (defined($output_encoding));
     my $got_count = 0;
     my $line;
     my $text;



reply via email to

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