texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Makefile.am, tp/Texinfo/ParserNonXS.pm (_enc


From: Patrice Dumas
Subject: branch master updated: * tp/Makefile.am, tp/Texinfo/ParserNonXS.pm (_encoding_alias) (%canonical_texinfo_encodings): remove Texinfo::Encoding, put the code directly in tp/Texinfo/ParserNonXS.pm.
Date: Fri, 18 Feb 2022 17:02:41 -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 637f931d80 * tp/Makefile.am, tp/Texinfo/ParserNonXS.pm 
(_encoding_alias) (%canonical_texinfo_encodings): remove Texinfo::Encoding, put 
the code directly in tp/Texinfo/ParserNonXS.pm.
637f931d80 is described below

commit 637f931d80f4c53b38b03d2a170aa30ef312274b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Feb 18 23:02:18 2022 +0100

    * tp/Makefile.am, tp/Texinfo/ParserNonXS.pm (_encoding_alias)
    (%canonical_texinfo_encodings): remove Texinfo::Encoding, put
    the code directly in tp/Texinfo/ParserNonXS.pm.
---
 ChangeLog                          |   6 ++
 tp/Makefile.am                     |   1 -
 tp/Texinfo/Convert/HTML.pm         |   1 -
 tp/Texinfo/Convert/Unicode.pm      |   2 -
 tp/Texinfo/Encoding.pm             | 114 -------------------------------------
 tp/Texinfo/ParserNonXS.pm          |  32 ++++++++++-
 tp/Texinfo/XS/parsetexi/end_line.c |   2 +-
 7 files changed, 36 insertions(+), 122 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 77ab5557b1..5c703acaa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-02-18  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Makefile.am, tp/Texinfo/ParserNonXS.pm (_encoding_alias)
+       (%canonical_texinfo_encodings): remove Texinfo::Encoding, put
+       the code directly in tp/Texinfo/ParserNonXS.pm.
+
 2022-02-18  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Encoding.pm (encoding_alias): use Encode::find_encoding,
diff --git a/tp/Makefile.am b/tp/Makefile.am
index f499b54d0a..7be4620984 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -69,7 +69,6 @@ dist_modules_DATA = \
  Texinfo/ParserNonXS.pm \
  Texinfo/Report.pm \
  Texinfo/Common.pm \
- Texinfo/Encoding.pm \
  Texinfo/Structuring.pm \
  Texinfo/Transformations.pm \
  Texinfo/Translations.pm \
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 27824b019f..e331a51e28 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -50,7 +50,6 @@ use Storable;
 
 use Texinfo::Common;
 use Texinfo::Config;
-use Texinfo::Encoding;
 use Texinfo::Convert::Unicode;
 use Texinfo::Convert::Texinfo;
 use Texinfo::Convert::Utils;
diff --git a/tp/Texinfo/Convert/Unicode.pm b/tp/Texinfo/Convert/Unicode.pm
index 7b1b7b3d91..28c4bde526 100644
--- a/tp/Texinfo/Convert/Unicode.pm
+++ b/tp/Texinfo/Convert/Unicode.pm
@@ -32,8 +32,6 @@ use Encode;
 use Unicode::Normalize;
 use Unicode::EastAsianWidth;
 
-use Texinfo::Encoding;
-
 use Texinfo::MiscXS;
 
 require Exporter;
diff --git a/tp/Texinfo/Encoding.pm b/tp/Texinfo/Encoding.pm
deleted file mode 100644
index 6195737c3d..0000000000
--- a/tp/Texinfo/Encoding.pm
+++ /dev/null
@@ -1,114 +0,0 @@
-# Encoding.pm: Encodings definitions and aliases.
-#
-# Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License,
-# or (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-# 
-# Original author: Patrice Dumas <pertusus@free.fr>
-# Parts (also from Patrice Dumas) come from texi2html.pl or texi2html.init.
-
-package Texinfo::Encoding;
-
-use strict;
-
-use Encode qw(find_encoding);
-
-require Exporter;
-use vars qw(@ISA @EXPORT_OK);
-@ISA = qw(Exporter);
-
-@EXPORT_OK = qw( encoding_alias );
-
-my %canonical_texinfo_encodings;
-# These are the encodings from the texinfo manual
-foreach my $canonical_encoding ('us-ascii', 'utf-8', 'iso-8859-1',
-                  'iso-8859-15', 'iso-8859-2', 'koi8-r', 'koi8-u') {
-  $canonical_texinfo_encodings{$canonical_encoding} = 1;
-}
-
-sub encoding_alias($)
-{
-  my $encoding = shift;
-  my $enc = find_encoding($encoding);
-  my ($perl_encoding, $canonical_output_encoding);
-  if (defined($enc)) {
-    $perl_encoding = $enc->name();
-    # mime_name() is upper-case, our keys are lower case, set to lower case
-    $canonical_output_encoding = lc($enc->mime_name());
-  }
-  my $canonical_texinfo_encoding;
-  foreach my $possible_encoding ($encoding, $canonical_output_encoding,
-                                            $perl_encoding) {
-    if (defined($possible_encoding)
-        and $canonical_texinfo_encodings{lc($possible_encoding)}) {
-      $canonical_texinfo_encoding = $possible_encoding;
-    }
-  }
-  return ($canonical_texinfo_encoding, $perl_encoding, 
$canonical_output_encoding);
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Texinfo::Encoding - Encodings and encoding aliases
-
-=head1 SYNOPSIS
-
-  use Texinfo::Encoding qw(encoding_alias);
-
-  my ($canonical_texinfo_encoding, $perl_encoding,
-      $canonical_output_encoding) = encoding_alias($encoding);
-
-=head1 NOTES
-
-The Texinfo Perl module main purpose is to be used in C<texi2any> to convert
-Texinfo to other formats.  There is no promise of API stability.
-
-=head1 DESCRIPTION
-
-Texinfo::Encoding takes care of encoding definition and aliasing.
-
-=head1 METHODS
-
-=over
-
-=item ($canonical_texinfo_encoding, $perl_encoding, 
$canonical_output_encoding) = encoding_alias($encoding)
-X<C<encoding_alias>>
-
-Taking an encoding name as argument, the function returns the
-corresponding canonical Texinfo encoding I<$canonical_texinfo_encoding>
-as described in the Texinfo manual (or C<undef>), an encoding name suitable
-for perl I<$perl_encoding>, and an encoding name suitable for most
-output formats, especially HTML, I<$canonical_output_encoding>.
-
-=back
-
-=head1 AUTHOR
-
-Patrice Dumas, E<lt>pertusus@free.frE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2010- Free Software Foundation, Inc.  See the source file for
-all copyright years.
-
-This library is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at
-your option) any later version.
-
-=cut
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 4c581a629d..83959afe6d 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -50,8 +50,6 @@ use Storable qw(dclone); # standard in 5.007003
 use Texinfo::Common;
 # Error reporting and counting
 use Texinfo::Report;
-# encoding_alias
-use Texinfo::Encoding;
 
 # in error messages, and for macro body expansion
 use Texinfo::Convert::Texinfo;
@@ -537,6 +535,34 @@ foreach my $other_forbidden_index_name 
('info','ps','pdf','htm',
   $forbidden_index_name{$other_forbidden_index_name} = 1;
 }
 
+my %canonical_texinfo_encodings;
+# These are the encodings from the texinfo manual
+foreach my $canonical_encoding ('us-ascii', 'utf-8', 'iso-8859-1',
+                  'iso-8859-15', 'iso-8859-2', 'koi8-r', 'koi8-u') {
+  $canonical_texinfo_encodings{$canonical_encoding} = 1;
+}
+
+sub _encoding_alias($)
+{
+  my $encoding = shift;
+  my $enc = find_encoding($encoding);
+  my ($perl_encoding, $canonical_output_encoding);
+  if (defined($enc)) {
+    $perl_encoding = $enc->name();
+    # mime_name() is upper-case, our keys are lower case, set to lower case
+    $canonical_output_encoding = lc($enc->mime_name());
+  }
+  my $canonical_texinfo_encoding;
+  foreach my $possible_encoding ($encoding, $canonical_output_encoding,
+                                            $perl_encoding) {
+    if (defined($possible_encoding)
+        and $canonical_texinfo_encodings{lc($possible_encoding)}) {
+      $canonical_texinfo_encoding = $possible_encoding;
+    }
+  }
+  return ($canonical_texinfo_encoding, $perl_encoding, 
$canonical_output_encoding);
+}
+
 # contexts on the context_stack stack where empty line doesn't trigger
 # a paragraph
 my %no_paragraph_contexts;
@@ -3206,7 +3232,7 @@ sub _end_line($$$)
             if defined $self->{'info'}->{'input_perl_encoding'};
         } elsif ($command eq 'documentencoding') {
           my ($texinfo_encoding, $perl_encoding, $input_encoding)
-            = Texinfo::Encoding::encoding_alias($text);
+             = _encoding_alias($text);
           $self->_command_warn($current, $line_nr,
                  __("encoding `%s' is not a canonical texinfo encoding"),
                                $text)
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index cd05a004c1..168d33304f 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1551,7 +1551,7 @@ end_line_misc_line (ELEMENT *current)
                 {
                   command_warn (current, "unrecognized encoding name `%s'",
                                 text);
-                  /* Texinfo::Encoding calls Encode::find_encoding, so knows
+                  /* the Perl Parser calls Encode::find_encoding, so knows
                      about more encodings than what we know about here.
                      TODO: Check when perl_encoding could be defined when 
                      texinfo_encoding isn't.



reply via email to

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