texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/TexinfoXML.pm (_convert): in


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/TexinfoXML.pm (_convert): instead of extra key end_command, determine the end command of a block command as the last in contents.
Date: Wed, 07 Sep 2022 15:29:29 -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 e9e122ca71 * tp/Texinfo/Convert/TexinfoXML.pm (_convert): instead of 
extra key end_command, determine the end command of a block command as the last 
in contents.
e9e122ca71 is described below

commit e9e122ca711a3cec767b5716c846a79ba39e0028
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Sep 7 21:29:12 2022 +0200

    * tp/Texinfo/Convert/TexinfoXML.pm (_convert): instead of
    extra key end_command, determine the end command of a block
    command as the last in contents.
---
 ChangeLog                                               |  6 ++++++
 tp/Texinfo/Convert/TexinfoXML.pm                        | 17 ++++++++++++++---
 tp/t/results/menu/block_commands_in_menu_description.pl |  1 -
 tp/t/results/menu/formats_in_menu.pl                    |  1 -
 tp/t/results/xml_tests/commands_and_spaces.pl           |  1 -
 tp/t/results/xml_tests/spaces_info_lost.pl              |  1 -
 6 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cef5d76d8d..478d60bbc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-07  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/TexinfoXML.pm (_convert): instead of
+       extra key end_command, determine the end command of a block
+       command as the last in contents.
+
 2022-09-07  Patrice Dumas  <pertusus@free.fr>
 
        Remove command_argument extra key
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index 46cebdb841..7d8c907498 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -1351,7 +1351,14 @@ sub _convert($$;$)
       if ($self->{'expanded_formats_hash'}->{$element->{'cmdname'}}) {
         $self->{'document_context'}->[-1]->{'raw'} = 1;
       } else {
-        my $end_command = $element->{'extra'}->{'end_command'};
+        my $end_command;
+        if ($element->{'contents'} and scalar(@{$element->{'contents'}}) > 0
+            # TODO when the raw commands have a proper end comment, the 
following
+            # will become true and code may need to change
+            and $element->{'contents'}->[-1]->{'cmdname'}
+            and $element->{'contents'}->[-1]->{'cmdname'} eq 'end') {
+          $end_command = $element->{'contents'}->[-1];
+        }
         my $end_command_space = 
[_leading_spaces_before_argument($end_command)];
         if (scalar(@$end_command_space)) {
           $end_command_space->[0] = 'endspaces';
@@ -1681,8 +1688,12 @@ sub _convert($$;$)
       and exists($Texinfo::Common::block_commands{$element->{'cmdname'}})) {
     if ($self->{'expanded_formats_hash'}->{$element->{'cmdname'}}) {
     } else {
-      my $end_command = $element->{'extra'}->{'end_command'};
-      if ($end_command) {
+      if ($element->{'contents'} and scalar(@{$element->{'contents'}}) > 0
+          # TODO when the raw commands have a proper end comment, the following
+          # will become true and code may need to change
+          and $element->{'contents'}->[-1]->{'cmdname'}
+          and $element->{'contents'}->[-1]->{'cmdname'} eq 'end') {
+        my $end_command = $element->{'contents'}->[-1];
         $result .= _end_line_spaces($self, $end_command);
         $result .= $self->format_comment_or_return_end_line($end_command);
       }
diff --git a/tp/t/results/menu/block_commands_in_menu_description.pl 
b/tp/t/results/menu/block_commands_in_menu_description.pl
index 4fcb0f930e..4431c847e5 100644
--- a/tp/t/results/menu/block_commands_in_menu_description.pl
+++ b/tp/t/results/menu/block_commands_in_menu_description.pl
@@ -504,7 +504,6 @@ $result_trees{'block_commands_in_menu_description'} = {
                           'type' => 'raw'
                         }
                       ],
-                      'extra' => {},
                       'parent' => {},
                       'source_info' => {
                         'file_name' => '',
diff --git a/tp/t/results/menu/formats_in_menu.pl 
b/tp/t/results/menu/formats_in_menu.pl
index 90a2f5e09e..9b75f2e6a7 100644
--- a/tp/t/results/menu/formats_in_menu.pl
+++ b/tp/t/results/menu/formats_in_menu.pl
@@ -326,7 +326,6 @@ $result_trees{'formats_in_menu'} = {
                           'type' => 'raw'
                         }
                       ],
-                      'extra' => {},
                       'parent' => {},
                       'source_info' => {
                         'file_name' => '',
diff --git a/tp/t/results/xml_tests/commands_and_spaces.pl 
b/tp/t/results/xml_tests/commands_and_spaces.pl
index 1d41c14dcf..50b2146e71 100644
--- a/tp/t/results/xml_tests/commands_and_spaces.pl
+++ b/tp/t/results/xml_tests/commands_and_spaces.pl
@@ -1101,7 +1101,6 @@ $result_trees{'commands_and_spaces'} = {
               'type' => 'raw'
             }
           ],
-          'extra' => {},
           'parent' => {},
           'source_info' => {
             'file_name' => '',
diff --git a/tp/t/results/xml_tests/spaces_info_lost.pl 
b/tp/t/results/xml_tests/spaces_info_lost.pl
index 2d272d3112..d9727f88d0 100644
--- a/tp/t/results/xml_tests/spaces_info_lost.pl
+++ b/tp/t/results/xml_tests/spaces_info_lost.pl
@@ -105,7 +105,6 @@ $result_trees{'spaces_info_lost'} = {
               'type' => 'raw'
             }
           ],
-          'extra' => {},
           'parent' => {},
           'source_info' => {
             'file_name' => '',



reply via email to

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