texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Text.pm (brace_no_arg_command, _convert), tp/Texinfo/Convert/Unicode.pm, tp/Texinfo/Convert/Utils.pm: avoid autovivification if not needed. Only put @def* name element in contents to be converted if defined.
Date: Sun, 09 Oct 2022 17:12:59 -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 bd03ae0c1c * tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Text.pm 
(brace_no_arg_command, _convert), tp/Texinfo/Convert/Unicode.pm, 
tp/Texinfo/Convert/Utils.pm: avoid autovivification if not needed. Only put 
@def* name element in contents to be converted if defined.
bd03ae0c1c is described below

commit bd03ae0c1ca14459f2fe86e3c7b344a7075d49d6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 9 23:12:48 2022 +0200

    * tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Text.pm
    (brace_no_arg_command, _convert), tp/Texinfo/Convert/Unicode.pm,
    tp/Texinfo/Convert/Utils.pm: avoid autovivification if not needed.
    Only put @def* name element in contents to be converted if defined.
---
 ChangeLog                                   |  7 ++++++
 tp/Texinfo/Common.pm                        |  1 +
 tp/Texinfo/Config.pm                        |  1 +
 tp/Texinfo/Convert/IXIN.pm                  | 12 +++++++---
 tp/Texinfo/Convert/NodeNameNormalization.pm |  3 +++
 tp/Texinfo/Convert/ParagraphNonXS.pm        |  3 +++
 tp/Texinfo/Convert/Texinfo.pm               |  3 +++
 tp/Texinfo/Convert/Text.pm                  | 34 +++++++++++++++++++++--------
 tp/Texinfo/Convert/TextContent.pm           |  3 +++
 tp/Texinfo/Convert/Unicode.pm               |  6 ++++-
 tp/Texinfo/Convert/Utils.pm                 |  9 ++++++--
 tp/Texinfo/Report.pm                        |  3 +++
 tp/Texinfo/Translations.pm                  |  3 +++
 13 files changed, 73 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a0aa9eba91..bdc7d106f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-09  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/Text.pm
+       (brace_no_arg_command, _convert), tp/Texinfo/Convert/Unicode.pm,
+       tp/Texinfo/Convert/Utils.pm: avoid autovivification if not needed.
+       Only put @def* name element in contents to be converted if defined.
+
 2022-10-09  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/TexinfoMarkup.pm:
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index de7bf356a9..54b080249e 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -21,6 +21,7 @@
 package Texinfo::Common;
 
 use strict;
+
 # To check if there is no erroneous autovivification
 #no autovivification qw(fetch delete exists store strict);
 
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index d31f3d598b..78ba7ca34a 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -30,6 +30,7 @@
 package Texinfo::Config;
 
 use strict;
+
 # To check if there is no erroneous autovivification
 #no autovivification qw(fetch delete exists store strict);
 
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index 00e96524b2..bed02d8a51 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -65,6 +65,9 @@ package Texinfo::Convert::IXIN;
 use 5.00405;
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use MIME::Base64;
 use Carp qw(cluck);
 
@@ -279,7 +282,7 @@ sub _associated_node_id($$$;$)
 
     if ($root_command) {
       if (!$root_command->{'cmdname'} or $root_command->{'cmdname'} ne 'node') 
{
-        if ($element->{'extra'}->{'unit_command'}
+        if ($element and $element->{'extra'}
             and $element->{'extra'}->{'unit_command'}
             and $element->{'extra'}->{'unit_command'}->{'cmdname'}
             and $element->{'extra'}->{'unit_command'}->{'cmdname'} eq 'node') {
@@ -414,8 +417,9 @@ sub output_ixin($$)
         foreach my $command (@{$self->{'global_commands'}->{$global_command}}) 
{
           my ($element, $root_command) = _get_element($self, $command);
           # before first node
-          if (!defined($root_command->{'extra'})
-              or !defined($root_command->{'extra'}->{'normalized'})) {
+          if (not $root_command
+              or not defined($root_command->{'extra'})
+              or not defined($root_command->{'extra'}->{'normalized'})) {
             $setting_commands{$global_command} = $command;
           } else {
             # register the setting value at the end of the node
@@ -683,6 +687,7 @@ sub output_ixin($$)
                                            $self, $merged_index_entries);
     # first do the dts_text as the counts are needed for the dts index
     foreach my $index_name (sort(keys(%$entries))) {
+      $dts_information{$index_name} = {};
       my $dts_text_result = '';
       my $dts_entries_nr = 0;
       my $dts_in_code = $index_names->{$index_name}->{'in_code'};
@@ -726,6 +731,7 @@ sub output_ixin($$)
       if ($command->{'extra'} and $command->{'extra'}->{'misc_args'}
           and defined($command->{'extra'}->{'misc_args'}->[0])) {
         my $index_name = $command->{'extra'}->{'misc_args'}->[0];
+        $dts_information{$index_name} = {} if (!$dts_information{$index_name});
         push @{$dts_information{$index_name}->{'node_id'}}, 
$associated_node_id;
       }
     }
diff --git a/tp/Texinfo/Convert/NodeNameNormalization.pm 
b/tp/Texinfo/Convert/NodeNameNormalization.pm
index f7ae97e4b1..a83ba641a1 100644
--- a/tp/Texinfo/Convert/NodeNameNormalization.pm
+++ b/tp/Texinfo/Convert/NodeNameNormalization.pm
@@ -29,6 +29,9 @@ use strict;
 # used to match Unicode character classes.
 use if $] >= 5.014, re => '/a';
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use Unicode::Normalize;
 use Text::Unidecode;
 
diff --git a/tp/Texinfo/Convert/ParagraphNonXS.pm 
b/tp/Texinfo/Convert/ParagraphNonXS.pm
index 8a0ce1fb85..1cb442846b 100644
--- a/tp/Texinfo/Convert/ParagraphNonXS.pm
+++ b/tp/Texinfo/Convert/ParagraphNonXS.pm
@@ -28,6 +28,9 @@ use strict;
 
 use if $] >= 5.014, re => '/a';  # ASCII-only character classes in regexes
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use Unicode::EastAsianWidth;
 use Texinfo::Convert::Unicode;
 use Carp qw(cluck);
diff --git a/tp/Texinfo/Convert/Texinfo.pm b/tp/Texinfo/Convert/Texinfo.pm
index 8f1bd827c0..6919929ce5 100644
--- a/tp/Texinfo/Convert/Texinfo.pm
+++ b/tp/Texinfo/Convert/Texinfo.pm
@@ -23,6 +23,9 @@ package Texinfo::Convert::Texinfo;
 use 5.00405;
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use Carp qw(cluck confess);
 
 # commands definitions
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 070699adef..ed0606229c 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -22,10 +22,13 @@ package Texinfo::Convert::Text;
 use 5.00405;
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use File::Basename;
 
 use Data::Dumper;
-use Carp qw(cluck carp);
+use Carp qw(cluck carp confess);
 use Encode qw(decode);
 
 use Texinfo::Commands;
@@ -249,7 +252,7 @@ sub brace_no_arg_command($;$)
       and defined($element->{'extra'}->{'clickstyle'})
       and 
defined($text_brace_no_arg_commands{$element->{'extra'}->{'clickstyle'}}));
   my $result;
-  if (!$options->{'ascii_punctuation'}
+  if (!($options and $options->{'ascii_punctuation'})
         or !exists($Texinfo::Convert::Unicode::extra_unicode_map{$command})) {
     $result = Texinfo::Convert::Unicode::brace_no_arg_command($command, 
$encoding);
   }
@@ -313,7 +316,8 @@ sub text_heading($$$;$$)
     $indent_length = 0;
   }
   my $section_level;
-  if (!defined($current->{'structure'}->{'section_level'})) {
+  if (!defined($current->{'structure'})
+      or !defined($current->{'structure'}->{'section_level'})) {
     $section_level = Texinfo::Common::section_level($current);
   } else {
     $section_level = $current->{'structure'}->{'section_level'};
@@ -380,6 +384,12 @@ sub _convert($;$)
   my $element = shift;
   my $options = shift;
 
+  $options = {} if (!defined($options));
+
+  if (!defined($element)) {
+    confess("Texinfo::Convert::Text::_convert: element undef");
+  }
+
   return '' if (!($element->{'type'} and $element->{'type'} eq 'def_line')
      and (($element->{'type'} and $ignored_types{$element->{'type'}})
           or ($element->{'cmdname'}
@@ -391,8 +401,9 @@ sub _convert($;$)
                      and 
$Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq 'inline'
                      and $element->{'cmdname'} ne 'inlinefmtifelse'
                      and 
(($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
-                          and (!$element->{'extra'}->{'format'}
-                               or 
!$options->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}}))
+                           and (!$element->{'extra'}->{'format'}
+                                or !$options->{'expanded_formats_hash'}
+                                or 
!$options->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}}))
                          or 
(!$Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
                              and 
!defined($element->{'extra'}->{'expand_index'}))))
              # here ignore most of the line commands
@@ -502,6 +513,7 @@ sub _convert($;$)
       my $arg_index = 1;
       if ($element->{'cmdname'} eq 'inlinefmtifelse'
           and (!$element->{'extra'}->{'format'}
+               or !$options->{'expanded_formats_hash'}
                or 
!$options->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}})) {
         $arg_index = 2;
       }
@@ -542,7 +554,8 @@ sub _convert($;$)
         chomp ($result);
         $result .= "\n" if ($result =~ /\S/);
       }
-    } elsif ($options->{'expanded_formats_hash'}->{$element->{'cmdname'}}) {
+    } elsif ($options->{'expanded_formats_hash'}
+             and $options->{'expanded_formats_hash'}->{$element->{'cmdname'}}) 
{
       $options->{'raw'} = 1;
     } elsif ($formatted_line_commands{$element->{'cmdname'}}
              and $element->{'args'}) {
@@ -589,7 +602,7 @@ sub _convert($;$)
   if ($element->{'type'} and $element->{'type'} eq 'def_line') {
     #print STDERR "$element->{'extra'}->{'def_command'}\n";
     if ($element->{'extra'} and $element->{'extra'}->{'def_parsed_hash'}
-             and %{$element->{'extra'}->{'def_parsed_hash'}}) {
+             and scalar(keys(%{$element->{'extra'}->{'def_parsed_hash'}}))) {
       my $parsed_definition_category
         = 
Texinfo::Convert::Utils::definition_category_tree($options->{'converter'},
                                                        $element);
@@ -598,7 +611,9 @@ sub _convert($;$)
         push @contents, ($element->{'extra'}->{'def_parsed_hash'}->{'type'},
                          {'text' => ' '});
       }
-      push @contents, $element->{'extra'}->{'def_parsed_hash'}->{'name'};
+      if ($element->{'extra'}->{'def_parsed_hash'}->{'name'}) {
+        push @contents, $element->{'extra'}->{'def_parsed_hash'}->{'name'};
+      }
 
       my $arguments = 
Texinfo::Convert::Utils::definition_arguments_content($element);
       if ($arguments) {
@@ -679,7 +694,7 @@ sub converter($)
     #print STDERR "CTe ".join("|", sort(keys(%{$conf})))."\n";
   }
 
-  my $expanded_formats = $converter->{'EXPANDED_FORMATS'};;
+  my $expanded_formats = $converter->{'EXPANDED_FORMATS'};
   if ($converter->{'parser'}) {
     $converter->{'parser_info'} = $converter->{'parser'}->global_information();
     $converter->{'global_commands'}
@@ -703,6 +718,7 @@ sub converter($)
     delete $converter->{'parser'};
   }
   if ($expanded_formats) {
+    $converter->{'expanded_formats_hash'} = {};
     foreach my $expanded_format(@$expanded_formats) {
       $converter->{'expanded_formats_hash'}->{$expanded_format} = 1;
     }
diff --git a/tp/Texinfo/Convert/TextContent.pm 
b/tp/Texinfo/Convert/TextContent.pm
index d1053ea1a1..d6aef7f1b2 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -22,6 +22,9 @@ package Texinfo::Convert::TextContent;
 use 5.00405;
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use Texinfo::Commands;
 use Texinfo::Common;
 use Texinfo::Convert::Utils;
diff --git a/tp/Texinfo/Convert/Unicode.pm b/tp/Texinfo/Convert/Unicode.pm
index fc83a381a3..a51d5fe3f4 100644
--- a/tp/Texinfo/Convert/Unicode.pm
+++ b/tp/Texinfo/Convert/Unicode.pm
@@ -26,6 +26,9 @@ package Texinfo::Convert::Unicode;
 use 5.007_003;
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use Carp qw(cluck);
 
 use Encode;
@@ -1445,7 +1448,8 @@ sub _format_eight_bit_accents_stack($$$$$;$)
 
   # handle the remaining accents, that have not been converted to 8bit
   # compatible unicode
-  shift @results_stack if (!defined($results_stack[0]->[1]));
+  shift @results_stack if (scalar(@results_stack)
+                           and !defined($results_stack[0]->[1]));
   while (@results_stack) {
     $result = &$convert_accent($converter, $result,
                                $results_stack[0]->[1],
diff --git a/tp/Texinfo/Convert/Utils.pm b/tp/Texinfo/Convert/Utils.pm
index 51b9037539..713068f422 100644
--- a/tp/Texinfo/Convert/Utils.pm
+++ b/tp/Texinfo/Convert/Utils.pm
@@ -30,6 +30,9 @@ package Texinfo::Convert::Utils;
 
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 # debugging
 use Carp qw(cluck);
 
@@ -288,7 +291,8 @@ sub add_heading_number($$$;$)
   my $numbered = shift;
 
   my $number;
-  if (defined($current->{'structure'}->{'section_number'})
+  if ($current->{'structure'}
+      and defined($current->{'structure'}->{'section_number'})
       and ($numbered or !defined($numbered))) {
     $number = $current->{'structure'}->{'section_number'};
   }
@@ -351,7 +355,8 @@ sub translated_command_tree($$)
 {
   my $self = shift;
   my $cmdname = shift;
-  if ($self->{'translated_commands'}->{$cmdname}) {
+  if ($self->{'translated_commands'}
+      and $self->{'translated_commands'}->{$cmdname}) {
     return $self->gdt($self->{'translated_commands'}->{$cmdname});
   }
   return undef;
diff --git a/tp/Texinfo/Report.pm b/tp/Texinfo/Report.pm
index d05261feb3..39c89db446 100644
--- a/tp/Texinfo/Report.pm
+++ b/tp/Texinfo/Report.pm
@@ -22,6 +22,9 @@ package Texinfo::Report;
 use 5.00405;
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 # for fileparse
 use File::Basename;
 
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index fb98164cd1..87e281accc 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -22,6 +22,9 @@ package Texinfo::Translations;
 use 5.00405;
 use strict;
 
+# To check if there is no erroneous autovivification
+#no autovivification qw(fetch delete exists store strict);
+
 use Encode;
 use POSIX qw(setlocale LC_ALL);
 use Locale::Messages;



reply via email to

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