texinfo-commits
[Top][All Lists]
Advanced

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

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


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/TexinfoMarkup.pm: avoid autovivification if not needed.
Date: Sun, 09 Oct 2022 14:33:02 -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 e4394b5eeb * tp/Texinfo/Convert/DocBook.pm, 
tp/Texinfo/Convert/TexinfoMarkup.pm: avoid autovivification if not needed.
e4394b5eeb is described below

commit e4394b5eeb5bca7f4b579fdc0925554c2d0d8de3
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 9 20:32:50 2022 +0200

    * tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/TexinfoMarkup.pm:
    avoid autovivification if not needed.
---
 ChangeLog                                             |  5 +++++
 tp/Texinfo/Convert/DocBook.pm                         |  6 +++++-
 tp/Texinfo/Convert/TexinfoMarkup.pm                   | 16 ++++++++++++----
 tp/t/results/converters_tests/form_feeds.pl           |  3 +--
 tp/t/results/converters_tests/ref_error_formatting.pl | 18 ------------------
 tp/t/results/converters_tests/ref_in_sectioning.pl    |  4 ----
 tp/t/results/misc_commands/ref_in_center.pl           |  1 -
 tp/t/results/preformatted/caption_in_example.pl       |  3 +--
 tp/t/results/sectioning/double_node_anchor_float.pl   |  6 ++----
 9 files changed, 26 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eb8fad1fd6..a0aa9eba91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-09  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/TexinfoMarkup.pm:
+       avoid autovivification if not needed.
+
 2022-10-09  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/LaTeX.pm (_prepare_conversion): avoid
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index c87d2fc197..6f59761981 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -22,6 +22,9 @@ package Texinfo::Convert::DocBook;
 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;
 
@@ -1172,7 +1175,8 @@ sub _convert($$;$)
             return '';
           } else {
             my $linkend = '';
-            if ($element->{'extra'}->{'node_argument'}
+            if ($element->{'extra'}
+                and $element->{'extra'}->{'node_argument'}
                 and 
defined($element->{'extra'}->{'node_argument'}->{'normalized'})
                 and 
!$element->{'extra'}->{'node_argument'}->{'manual_content'}) {
               $linkend = " 
linkend=\"$element->{'extra'}->{'node_argument'}->{'normalized'}\"";
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 2bb85c071a..85847b627f 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -32,6 +32,9 @@ package Texinfo::Convert::TexinfoMarkup;
 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::Converter;
@@ -845,7 +848,9 @@ sub _convert($$;$)
         # the command associated with an element is closed at the end of the
         # element. @bye is withing the element, but we want it to appear after
         # the command closing.  So we delay the output of @bye, and store it.
-        if ($cmdname eq 'bye' and $element->{'structure'}->{'associated_unit'}
+        if ($cmdname eq 'bye' and $element->{'structure'}
+            and $element->{'structure'}->{'associated_unit'}
+            and $element->{'structure'}->{'associated_unit'}->{'extra'}
             and 
defined($element->{'structure'}->{'associated_unit'}->{'extra'}->{'unit_command'}))
 {
           $self->{'pending_bye'} = $self->txi_markup_open_element($cmdname)
                     .$self->txi_markup_close_element($cmdname)."\n";
@@ -1103,7 +1108,8 @@ sub _convert($$;$)
       } elsif ($Texinfo::Commands::ref_commands{$element->{'cmdname'}}) {
         if ($element->{'args'}) {
           my $normalized;
-          if ($element->{'extra'}->{'node_argument'}
+          if ($element->{'extra'}
+              and $element->{'extra'}->{'node_argument'}
               and $element->{'extra'}->{'node_argument'}->{'node_content'}) {
             my $normalized;
             if 
(defined($element->{'extra'}->{'node_argument'}->{'normalized'})) {
@@ -1130,7 +1136,8 @@ sub _convert($$;$)
                  {'code' => 1,
                   Texinfo::Convert::Text::copy_options_for_convert_text($self, 
1)});
           }
-          if (!defined($manual) and $element->{'extra'}->{'node_argument'}
+          if (!defined($manual) and $element->{'extra'}
+              and $element->{'extra'}->{'node_argument'}
               and $element->{'extra'}->{'node_argument'}->{'manual_content'}) {
             $manual = Texinfo::Convert::Text::convert_to_text({'contents'
                    => 
$element->{'extra'}->{'node_argument'}->{'manual_content'}},
@@ -1180,7 +1187,8 @@ sub _convert($$;$)
             defined($element->{'extra'}->{'type'}->{'normalized'})) {
           push @$attribute, ['type', 
$element->{'extra'}->{'type'}->{'normalized'}];
         }
-        if (defined($element->{'structure'}->{'float_number'})) {
+        if ($element->{'structure'}
+            and defined($element->{'structure'}->{'float_number'})) {
           push @$attribute, ['number', 
$element->{'structure'}->{'float_number'}];
         }
       } elsif ($element->{'cmdname'} eq 'verbatim') {
diff --git a/tp/t/results/converters_tests/form_feeds.pl 
b/tp/t/results/converters_tests/form_feeds.pl
index 0df61cdcd7..d2ead55afd 100644
--- a/tp/t/results/converters_tests/form_feeds.pl
+++ b/tp/t/results/converters_tests/form_feeds.pl
@@ -1250,8 +1250,7 @@ $result_floats{'form_feeds'} = {
         'type' => {
           'normalized' => ''
         }
-      },
-      'structure' => {}
+      }
     }
   ]
 };
diff --git a/tp/t/results/converters_tests/ref_error_formatting.pl 
b/tp/t/results/converters_tests/ref_error_formatting.pl
index de930cef11..24e57ac5ff 100644
--- a/tp/t/results/converters_tests/ref_error_formatting.pl
+++ b/tp/t/results/converters_tests/ref_error_formatting.pl
@@ -163,7 +163,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -239,7 +238,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -319,7 +317,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -403,7 +400,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -1898,7 +1894,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -1984,7 +1979,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2074,7 +2068,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2166,7 +2159,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2262,7 +2254,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2370,7 +2361,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2456,7 +2446,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2546,7 +2535,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2648,7 +2636,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2738,7 +2725,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2825,7 +2811,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'inforef',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2901,7 +2886,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'inforef',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -2986,7 +2970,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'inforef',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -3044,7 +3027,6 @@ $result_trees{'ref_error_formatting'} = {
                 }
               ],
               'cmdname' => 'inforef',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
diff --git a/tp/t/results/converters_tests/ref_in_sectioning.pl 
b/tp/t/results/converters_tests/ref_in_sectioning.pl
index 8a22000b4c..1c42973d68 100644
--- a/tp/t/results/converters_tests/ref_in_sectioning.pl
+++ b/tp/t/results/converters_tests/ref_in_sectioning.pl
@@ -1352,7 +1352,6 @@ $result_trees{'ref_in_sectioning'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -1425,7 +1424,6 @@ $result_trees{'ref_in_sectioning'} = {
                 }
               ],
               'cmdname' => 'ref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -1687,7 +1685,6 @@ $result_trees{'ref_in_sectioning'} = {
                 }
               ],
               'cmdname' => 'pxref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
@@ -1839,7 +1836,6 @@ $result_trees{'ref_in_sectioning'} = {
                 }
               ],
               'cmdname' => 'xref',
-              'extra' => {},
               'parent' => {},
               'source_info' => {
                 'file_name' => '',
diff --git a/tp/t/results/misc_commands/ref_in_center.pl 
b/tp/t/results/misc_commands/ref_in_center.pl
index 1708eb531e..17aeb4b2e0 100644
--- a/tp/t/results/misc_commands/ref_in_center.pl
+++ b/tp/t/results/misc_commands/ref_in_center.pl
@@ -255,7 +255,6 @@ $result_trees{'ref_in_center'} = {
                     }
                   ],
                   'cmdname' => 'ref',
-                  'extra' => {},
                   'parent' => {},
                   'source_info' => {
                     'file_name' => '',
diff --git a/tp/t/results/preformatted/caption_in_example.pl 
b/tp/t/results/preformatted/caption_in_example.pl
index 9b67e1e7dc..eeaddf16fa 100644
--- a/tp/t/results/preformatted/caption_in_example.pl
+++ b/tp/t/results/preformatted/caption_in_example.pl
@@ -289,8 +289,7 @@ $result_floats{'caption_in_example'} = {
           ],
           'normalized' => 'float'
         }
-      },
-      'structure' => {}
+      }
     }
   ]
 };
diff --git a/tp/t/results/sectioning/double_node_anchor_float.pl 
b/tp/t/results/sectioning/double_node_anchor_float.pl
index 9237439817..65b209c1a5 100644
--- a/tp/t/results/sectioning/double_node_anchor_float.pl
+++ b/tp/t/results/sectioning/double_node_anchor_float.pl
@@ -748,8 +748,7 @@ $result_floats{'double_node_anchor_float'} = {
           ],
           'normalized' => 'Text'
         }
-      },
-      'structure' => {}
+      }
     },
     {
       'cmdname' => 'float',
@@ -762,8 +761,7 @@ $result_floats{'double_node_anchor_float'} = {
           ],
           'normalized' => 'Text'
         }
-      },
-      'structure' => {}
+      }
     },
     {
       'cmdname' => 'float',



reply via email to

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