texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 4 Feb 2024 12:38:18 -0500 (EST)

branch: master
commit 5154587461e203b06ae0d36ef2aa7046917d727d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Feb 4 18:38:08 2024 +0100

    * tp/Texinfo/Common.pm (%text_brace_no_arg_commands),
    tp/Texinfo/Convert/NodeNameNormalization.pm,
    tp/Texinfo/Convert/Text.pm: move %text_brace_no_arg_commands to
    Texinfo/Common.pm to avoid a dependency of NodeNameNormalization.pm on
    Text.pm as it leads to a circular dependency as Text.pm depends
    indirectly on NodeNameNormalization.pm.
---
 ChangeLog                                   |  9 ++++
 tp/Texinfo/Common.pm                        | 67 ++++++++++++++++++++++++++
 tp/Texinfo/Convert/NodeNameNormalization.pm | 12 +++--
 tp/Texinfo/Convert/Text.pm                  | 73 ++---------------------------
 tp/Texinfo/Convert/TextContent.pm           |  2 +-
 tp/Texinfo/Translations.pm                  |  6 +--
 tp/init/html32.pm                           |  4 +-
 tp/maintain/setup_converters_code_tables.pl |  5 +-
 8 files changed, 96 insertions(+), 82 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 50d2681e39..e4dc87d106 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-02-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (%text_brace_no_arg_commands),
+       tp/Texinfo/Convert/NodeNameNormalization.pm,
+       tp/Texinfo/Convert/Text.pm: move %text_brace_no_arg_commands to
+       Texinfo/Common.pm to avoid a dependency of NodeNameNormalization.pm on
+       Text.pm as it leads to a circular dependency as Text.pm depends
+       indirectly on NodeNameNormalization.pm.
+
 2024-02-04  Patrice Dumas  <pertusus@free.fr>
 
        * Texinfo/Convert/NodeNameNormalization.pm (_convert): rename $command
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 503c2cc476..c50f898559 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -393,6 +393,73 @@ our %nobrace_symbol_text;
            '\\', '\\',  # should only appear in math
 );
 
+# used by Texinfo::Convert::Text, Texinfo::Convert::NodeNormalization
+# and Texinfo::Convert::TextContent.
+our %text_brace_no_arg_commands = (
+               'TeX'                => 'TeX',
+               'LaTeX'              => 'LaTeX',
+               'bullet'             => '*',
+               'copyright'          => '(C)',
+               'registeredsymbol'   => '(R)',
+               'dots'         => '...',
+               'enddots'      => '...',
+               'equiv'        => '==',
+               'error'        => 'error-->',
+               'expansion'    => '==>',
+               'arrow'        => '->',
+               'minus'        => '-',
+               'point'        => '-!-',
+               'print'        => '-|',
+               'result'       => '=>',
+               'today'        => '',
+               'aa'           => 'aa',
+               'AA'           => 'AA',
+               'ae'           => 'ae',
+               'oe'           => 'oe',
+               'AE'           => 'AE',
+               'OE'           => 'OE',
+               'o'            => '/o',
+               'O'            => '/O',
+               'ss'           => 'ss',
+               'l'            => '/l',
+               'L'            => '/L',
+               'DH'           => 'D',
+               'dh'           => 'd',
+               'TH'           => 'TH', # 
http://www.evertype.com/standards/wynnyogh/thorn.html
+
+               'th'           => 'th',
+               'exclamdown'   => '!',
+               'questiondown' => '?',
+               'pounds'       => '#',
+               'ordf'         => 'a',
+               'ordm'         => 'o',
+               'comma'        => ',',
+               'atchar'       => '@',
+               'ampchar'      => '&',
+               'lbracechar'   => '{',
+               'rbracechar'   => '}',
+               'backslashchar' => '\\',
+               'hashchar'      => '#',
+               'euro'         => 'Euro',
+               'geq'          => '>=',
+               'leq'          => '<=',
+               'tie'          => ' ',
+               'textdegree'      => 'o',
+               'quotedblleft'    => '"',
+               'quotedblright'   => '"',
+               'quoteleft'       => '`',
+               'quoteright'      => "'",
+               'quotedblbase'    => ',,',
+               'quotesinglbase'  => ',',
+               'guillemetleft'   => '<<',
+               'guillemetright'  => '>>',
+               'guillemotleft'   => '<<',
+               'guillemotright'  => '>>',
+               'guilsinglleft'   => '<',
+               'guilsinglright'  => '>',
+               'click'           => '', # specially treated
+);
+
 our %def_map = (
     # basic commands.
     # 'arg' and 'argtype' are for everything appearing after the other
diff --git a/tp/Texinfo/Convert/NodeNameNormalization.pm 
b/tp/Texinfo/Convert/NodeNameNormalization.pm
index ad7df8d15a..0805861c04 100644
--- a/tp/Texinfo/Convert/NodeNameNormalization.pm
+++ b/tp/Texinfo/Convert/NodeNameNormalization.pm
@@ -37,12 +37,15 @@ use Text::Unidecode;
 
 # commands classes
 use Texinfo::Commands;
-# for nobrace_symbol_text
+# for nobrace_symbol_text and text_brace_no_arg_commands
 use Texinfo::Common;
 # use the hashes and functions
 use Texinfo::Convert::Unicode;
-# reuse conversion hashes
-use Texinfo::Convert::Text;
+
+# NOTE it is important that there is no dependency to Texinfo::Convert::Text
+# to avoid a dependency loop, in particular for data definition.
+# The loop would be Texinfo::Convert::Text -> Texinfo::Translations
+#   -> Texinfo::Parser -> this module
 
 require Exporter;
 use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
@@ -61,7 +64,8 @@ $VERSION = '7.1dev';
 
 
 my %normalize_node_brace_no_arg_commands
-  = %Texinfo::Convert::Text::text_brace_no_arg_commands;
+  = %Texinfo::Common::text_brace_no_arg_commands;
+
 foreach my $command 
(keys(%Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands)) {
   $normalize_node_brace_no_arg_commands{$command} =
      
$Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands{$command};
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 597ad2e7ac..a3196b026e 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -111,72 +111,6 @@ foreach my $ignored_command ('html', 'tex', 'xml', 
'docbook', 'latex') {
   $ignored_format_raw_commands{$ignored_command} = 1;
 }
 
-# used by Texinfo::Convert::NodeNormalization
-our %text_brace_no_arg_commands = (
-               'TeX'                => 'TeX',
-               'LaTeX'              => 'LaTeX',
-               'bullet'             => '*',
-               'copyright'          => '(C)',
-               'registeredsymbol'   => '(R)',
-               'dots'         => '...',
-               'enddots'      => '...',
-               'equiv'        => '==',
-               'error'        => 'error-->',
-               'expansion'    => '==>',
-               'arrow'        => '->',
-               'minus'        => '-',
-               'point'        => '-!-',
-               'print'        => '-|',
-               'result'       => '=>',
-               'today'        => '',
-               'aa'           => 'aa',
-               'AA'           => 'AA',
-               'ae'           => 'ae',
-               'oe'           => 'oe',
-               'AE'           => 'AE',
-               'OE'           => 'OE',
-               'o'            => '/o',
-               'O'            => '/O',
-               'ss'           => 'ss',
-               'l'            => '/l',
-               'L'            => '/L',
-               'DH'           => 'D',
-               'dh'           => 'd',
-               'TH'           => 'TH', # 
http://www.evertype.com/standards/wynnyogh/thorn.html
-
-               'th'           => 'th',
-               'exclamdown'   => '!',
-               'questiondown' => '?',
-               'pounds'       => '#',
-               'ordf'         => 'a',
-               'ordm'         => 'o',
-               'comma'        => ',',
-               'atchar'       => '@',
-               'ampchar'      => '&',
-               'lbracechar'   => '{',
-               'rbracechar'   => '}',
-               'backslashchar' => '\\',
-               'hashchar'      => '#',
-               'euro'         => 'Euro',
-               'geq'          => '>=',
-               'leq'          => '<=',
-               'tie'          => ' ',
-               'textdegree'      => 'o',
-               'quotedblleft'    => '"',
-               'quotedblright'   => '"',
-               'quoteleft'       => '`',
-               'quoteright'      => "'",
-               'quotedblbase'    => ',,',
-               'quotesinglbase'  => ',',
-               'guillemetleft'   => '<<',
-               'guillemetright'  => '>>',
-               'guillemotleft'   => '<<',
-               'guillemotright'  => '>>',
-               'guilsinglleft'   => '<',
-               'guilsinglright'  => '>',
-               'click'           => '', # specially treated
-);
-
 # used in C commands table generation
 our %sort_brace_no_arg_commands = (
   'copyright' => 'C',
@@ -410,7 +344,7 @@ sub brace_no_arg_command($;$)
   $command = $element->{'extra'}->{'clickstyle'}
      if ($element->{'extra'}
       and defined($element->{'extra'}->{'clickstyle'})
-      and defined($text_brace_no_arg_commands{
+      and defined($Texinfo::Common::text_brace_no_arg_commands{
                                   $element->{'extra'}->{'clickstyle'}}));
   my $result;
   if (defined($encoding) and
@@ -432,7 +366,7 @@ sub brace_no_arg_command($;$)
         and $sort_brace_no_arg_commands{$command}) {
       $result = $sort_brace_no_arg_commands{$command};
     } else {
-      $result = $text_brace_no_arg_commands{$command};
+      $result = $Texinfo::Common::text_brace_no_arg_commands{$command};
     }
   }
   if ($options and $Texinfo::Commands::letter_no_arg_commands{$command}) {
@@ -618,7 +552,8 @@ sub _convert($$)
         $year += ($year < 70) ? 2000 : 1900;
         return "$Texinfo::Convert::Utils::month_name[$mon] $mday, $year";
       }
-    } elsif (defined($text_brace_no_arg_commands{$element->{'cmdname'}})) {
+    } elsif (defined($Texinfo::Common::text_brace_no_arg_commands{
+                                                 $element->{'cmdname'}})) {
       return brace_no_arg_command($element, $options);
     # commands with braces
     } elsif ($accent_commands{$element->{'cmdname'}}) {
diff --git a/tp/Texinfo/Convert/TextContent.pm 
b/tp/Texinfo/Convert/TextContent.pm
index ac8ae23022..f419f1b88a 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -146,7 +146,7 @@ sub _convert($$)
         = localtime(time);
       $year += ($year < 70) ? 2000 : 1900;
       return "$Texinfo::Convert::Utils::month_name[$mon] $mday, $year";
-    } elsif 
(defined($Texinfo::Convert::Text::text_brace_no_arg_commands{$element->{'cmdname'}}))
 {
+    } elsif 
(defined($Texinfo::Common::text_brace_no_arg_commands{$element->{'cmdname'}})) {
       return Texinfo::Convert::Text::brace_no_arg_command($element, undef);
     } elsif ($Texinfo::Commands::accent_commands{$element->{'cmdname'}}) {
       my $result = Texinfo::Convert::Text::text_accents($element,
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index 02d82f084c..b8045a16c4 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -40,13 +40,13 @@ use Locale::Messages;
 # modules do not setup data such that their order of loading is not
 # important, as long as they load after their dependencies.
 
-# to load a parser
-use Texinfo::Parser;
-
 use Texinfo::DocumentXS;
 
 use Texinfo::Convert::Unicode;
 
+# to load a parser
+use Texinfo::Parser;
+
 # we want a reliable way to switch locale for the document
 # strings translations so we don't use the system gettext.
 Locale::Messages->select_package ('gettext_pp');
diff --git a/tp/init/html32.pm b/tp/init/html32.pm
index 2627b298f1..ae60d57cbb 100644
--- a/tp/init/html32.pm
+++ b/tp/init/html32.pm
@@ -37,7 +37,7 @@ use strict;
 
 use Texinfo::Commands;
 
-use Texinfo::Convert::Text;
+use Texinfo::Common;
 
 
 texinfo_set_from_init_file('COMPLEX_FORMAT_IN_TABLE', 1);
@@ -91,7 +91,7 @@ foreach my $command ('euro', 'geq', 'leq',
    'quotedblbase', 'quotesinglbase', 'guillemetleft', 'guillemetright',
    'guillemotleft', 'guillemotright', 'guilsinglleft', 'guilsinglright') {
   my $formatted_command = html32_format_protect_text(undef,
-             $Texinfo::Convert::Text::text_brace_no_arg_commands{$command});
+             $Texinfo::Common::text_brace_no_arg_commands{$command});
   texinfo_register_no_arg_command_formatting($command, undef, 
$formatted_command);
 }
 
diff --git a/tp/maintain/setup_converters_code_tables.pl 
b/tp/maintain/setup_converters_code_tables.pl
index 30b5f2eabc..a273c31ac0 100755
--- a/tp/maintain/setup_converters_code_tables.pl
+++ b/tp/maintain/setup_converters_code_tables.pl
@@ -58,9 +58,8 @@ BEGIN
 }
 
 use Texinfo::Common;
-use Texinfo::Convert::Text;
 use Texinfo::Convert::Unicode;
-
+use Texinfo::Convert::Text;
 
 
 my @commands_order = ('');
@@ -93,7 +92,7 @@ while (<STDIN>) {
 
 # Texinfo::Convert::NodeNameNormalization
 my %normalize_node_brace_no_arg_commands
-  = %Texinfo::Convert::Text::text_brace_no_arg_commands;
+  = %Texinfo::Common::text_brace_no_arg_commands;
 foreach my $command 
(keys(%Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands)) {
   $normalize_node_brace_no_arg_commands{$command} =
      
$Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands{$command};



reply via email to

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