texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (output, co


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (output, convert, _convert): do not use element units, simply convert the tree. Sections closed by root commands do not span following nodes.
Date: Wed, 28 Dec 2022 12:20:34 -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 8bd72250fd * tp/Texinfo/Convert/TexinfoMarkup.pm (output, convert, 
_convert): do not use element units, simply convert the tree.  Sections closed 
by root commands do not span following nodes.
8bd72250fd is described below

commit 8bd72250fd63e4a72db2fb0bb3088d8206edcbd2
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Dec 28 18:20:20 2022 +0100

    * tp/Texinfo/Convert/TexinfoMarkup.pm (output, convert, _convert):
    do not use element units, simply convert the tree.  Sections closed by
    root commands do not span following nodes.
---
 ChangeLog                                          |  6 ++
 tp/Texinfo/Convert/TexinfoMarkup.pm                | 70 +++-------------------
 tp/t/results/indices/explicit_sort_key.pl          |  2 +-
 .../indices/ignored_sort_char_empty_entries.pl     |  2 +-
 tp/t/results/indices/transparent_sort_chars.pl     |  2 +-
 tp/t/results/menu/comment_on_menu_line.pl          |  2 +-
 tp/t/results/sectioning/part_node_after_top.pl     |  2 +-
 .../sectioning/two_nodes_between_chapters.pl       |  2 +-
 8 files changed, 20 insertions(+), 68 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index edc7c2c4a0..87999bedbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-12-28  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/TexinfoMarkup.pm (output, convert, _convert):
+       do not use element units, simply convert the tree.  Sections closed by
+       root commands do not span following nodes.
+
 2022-12-28  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): check
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index bc6dcbc8d9..13f1458d72 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -330,11 +330,7 @@ sub output($$)
              .$self->txi_markup_close_element('filename')."\n";
     $result .= $self->write_or_return($filename_element, $fh);
   }
-  if ($self->get_conf('USE_NODES')) {
-    $result .= $self->convert_document_nodes($root, $fh);
-  } else {
-    $result .= $self->convert_document_sections($root, $fh);
-  }
+  $result .= $self->write_or_return($self->convert_tree($root), $fh);
   $result
     .= $self->write_or_return($self->txi_markup_close_element('texinfo')."\n",
                               $fh);
@@ -442,7 +438,7 @@ sub convert($$)
   my $self = shift;
   my $root = shift;
 
-  return $self->convert_document_sections($root);
+  return $self->convert_tree($root);
 }
 
 sub convert_tree($$)
@@ -923,19 +919,7 @@ sub _convert($$;$)
         }
         my $result = $self->txi_markup_open_element($cmdname, $attribute)
                  .$self->txi_markup_close_element($cmdname)."\n";
-        # 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'}
-            and $element->{'structure'}->{'associated_unit'}
-            and $element->{'structure'}->{'associated_unit'}->{'extra'}
-            and defined($element->{'structure'}->{'associated_unit'}
-                                               ->{'extra'}->{'unit_command'})) 
{
-          $self->{'pending_bye'} = $result;
-          return '';
-        } else {
-          return $result;
-        }
+        return $result;
       } elsif ($type eq 'special') {
         if ($cmdname eq 'clear' or $cmdname eq 'set') {
           my $attribute = [];
@@ -1672,10 +1656,6 @@ sub _convert($$;$)
   foreach my $format_element (@close_format_elements) {
     $result .= $self->txi_markup_close_element($format_element);
   }
-  if ($element->{'type'} and $element->{'type'} eq 'postamble_after_end') {
-    $self->{'pending_bye'} .= $result;
-    return '';
-  }
   if ($element->{'cmdname'}
       and exists($Texinfo::Commands::block_commands{$element->{'cmdname'}})) {
     if ($self->{'expanded_formats_hash'}->{$element->{'cmdname'}}) {
@@ -1694,26 +1674,10 @@ sub _convert($$;$)
     if ($self->{'context_block_commands'}->{$element->{'cmdname'}}) {
       pop @{$self->{'document_context'}};
     }
-  # The command is closed either when the corresponding tree element
-  # is done, and the command is not associated to an element, or when
-  # the element is closed.
-  } elsif ((($element->{'type'} and $element->{'type'} eq 'unit'
-             and $element->{'extra'} and $element->{'extra'}->{'unit_command'}
-             and !($element->{'extra'}->{'unit_command'}->{'cmdname'}
-                   and $element->{'extra'}->{'unit_command'}->{'cmdname'} eq 
'node'))
-            or ($element->{'cmdname'}
-                and $Texinfo::Commands::root_commands{$element->{'cmdname'}}
-                and $element->{'cmdname'} ne 'node'
-                and !($element->{'structure'}->{'associated_unit'}
-                     and 
$element->{'structure'}->{'associated_unit'}->{'extra'}
-                     and $element->{'structure'}->{'associated_unit'}
-                                                   
->{'extra'}->{'unit_command'}
-                     and $element->{'structure'}->{'associated_unit'}
-                                    ->{'extra'}->{'unit_command'} eq 
$element)))
+  } elsif ($element->{'cmdname'}
+           and $Texinfo::Commands::root_commands{$element->{'cmdname'}}
+           and $element->{'cmdname'} ne 'node'
            and !$self->get_conf('USE_NODES')) {
-    if ($element->{'type'} and $element->{'type'} eq 'unit') {
-      $element = $element->{'extra'}->{'unit_command'};
-    }
     my $level_adjusted_cmdname
        = Texinfo::Structuring::section_level_adjusted_command_name($element);
     if (!($element->{'structure'}->{'section_childs'}
@@ -1736,29 +1700,11 @@ sub _convert($$;$)
                ."\n";
       }
     }
-    if ($self->{'pending_bye'}) {
-      $result .= $self->{'pending_bye'};
-      delete $self->{'pending_bye'};
-    }
-  } elsif ((($element->{'type'} and $element->{'type'} eq 'unit'
-             and $element->{'extra'} and $element->{'extra'}->{'unit_command'}
-             and $element->{'extra'}->{'unit_command'}->{'cmdname'}
-             and $element->{'extra'}->{'unit_command'}->{'cmdname'} eq 'node')
-            or ($element->{'cmdname'}
-                and $element->{'cmdname'} eq 'node'
-                and !($element->{'structure'}->{'associated_unit'}
-                     and 
$element->{'structure'}->{'associated_unit'}->{'extra'}
-                     and $element->{'structure'}->{'associated_unit'}
-                                                   
->{'extra'}->{'unit_command'}
-                     and $element->{'structure'}->{'associated_unit'}
-                                    ->{'extra'}->{'unit_command'} eq 
$element)))
+  } elsif ($element->{'cmdname'}
+           and $element->{'cmdname'} eq 'node'
            and $self->get_conf('USE_NODES')) {
     $result .= $self->txi_markup_close_element('node');
 
-    if ($self->{'pending_bye'}) {
-      $result .= $self->{'pending_bye'};
-      delete $self->{'pending_bye'};
-    }
   }
   return $result;
 }
diff --git a/tp/t/results/indices/explicit_sort_key.pl 
b/tp/t/results/indices/explicit_sort_key.pl
index 62548659b6..d0be851658 100644
--- a/tp/t/results/indices/explicit_sort_key.pl
+++ b/tp/t/results/indices/explicit_sort_key.pl
@@ -983,6 +983,7 @@ $result_converted{'html_text'}->{'explicit_sort_key'} = 
'<div class="top-level-e
 $result_converted{'xml'}->{'explicit_sort_key'} = '<node name="Top" spaces=" 
"><nodename>Top</nodename><nodenext automatic="on">node</nodenext></node>
 <top><sectiontitle></sectiontitle>
 
+</top>
 <node name="node" spaces=" "><nodename>node</nodename><nodeprev 
automatic="on">Top</nodeprev></node>
 
 <defindex spaces=" " value="SK" line="SK"></defindex>
@@ -998,7 +999,6 @@ $result_converted{'xml'}->{'explicit_sort_key'} = '<node 
name="Top" spaces=" "><
 <url><urefurl>and cmd <sortas>inside</sortas></urefurl></url>.
 </para>
 <printindex spaces=" " value="SK" line="SK"></printindex>
-</top>
 ';
 
 
diff --git a/tp/t/results/indices/ignored_sort_char_empty_entries.pl 
b/tp/t/results/indices/ignored_sort_char_empty_entries.pl
index de992f20b1..317f742a39 100644
--- a/tp/t/results/indices/ignored_sort_char_empty_entries.pl
+++ b/tp/t/results/indices/ignored_sort_char_empty_entries.pl
@@ -680,6 +680,7 @@ 
$result_converted{'xml'}->{'ignored_sort_char_empty_entries'} = '<set name="txii
 <node name="Top" spaces=" "><nodename>Top</nodename><nodenext 
automatic="on">node</nodenext></node>
 <top><sectiontitle></sectiontitle>
 
+</top>
 <node name="node" spaces=" "><nodename>node</nodename><nodeprev 
automatic="on">Top</nodeprev></node>
 
 <findex index="fn" spaces=" "><indexterm index="fn" 
number="1">-</indexterm></findex>
@@ -688,7 +689,6 @@ 
$result_converted{'xml'}->{'ignored_sort_char_empty_entries'} = '<set name="txii
 <findex index="fn" spaces=" "><indexterm index="fn" 
number="4"><sortas>--</sortas> --</indexterm></findex>
 
 <printindex spaces=" " value="fn" line="fn"></printindex>
-</top>
 ';
 
 1;
diff --git a/tp/t/results/indices/transparent_sort_chars.pl 
b/tp/t/results/indices/transparent_sort_chars.pl
index 5c0e041c85..e2a88ca5d7 100644
--- a/tp/t/results/indices/transparent_sort_chars.pl
+++ b/tp/t/results/indices/transparent_sort_chars.pl
@@ -561,6 +561,7 @@ $result_converted{'xml'}->{'transparent_sort_chars'} = 
'<set name="txiindexhyphe
 <node name="Top" spaces=" "><nodename>Top</nodename><nodenext 
automatic="on">node</nodenext></node>
 <top><sectiontitle></sectiontitle>
 
+</top>
 <node name="node" spaces=" "><nodename>node</nodename><nodeprev 
automatic="on">Top</nodeprev></node>
 
 <cindex index="cp" spaces=" "><indexterm index="cp" 
number="1"><code>--version</code>, for 
<command>install-info</command></indexterm></cindex>
@@ -568,7 +569,6 @@ $result_converted{'xml'}->{'transparent_sort_chars'} = 
'<set name="txiindexhyphe
 <cindex index="cp" spaces=" "><indexterm index="cp" number="3">Semantic 
markup</indexterm></cindex>
 
 <printindex spaces=" " value="cp" line="cp"></printindex>
-</top>
 ';
 
 
diff --git a/tp/t/results/menu/comment_on_menu_line.pl 
b/tp/t/results/menu/comment_on_menu_line.pl
index 2be908309a..2daebc9057 100644
--- a/tp/t/results/menu/comment_on_menu_line.pl
+++ b/tp/t/results/menu/comment_on_menu_line.pl
@@ -444,8 +444,8 @@ $result_converted{'xml'}->{'comment_on_menu_line'} = '<node 
name="Top" spaces="
 </pre></menudescription></menuentry></menu>
 
 <chapter spaces=" "><sectiontitle>first</sectiontitle>
-<node name="first" spaces=" "><nodename>first</nodename><nodeprev 
automatic="on">Top</nodeprev><nodeup automatic="on">Top</nodeup></node>
 </chapter>
+<node name="first" spaces=" "><nodename>first</nodename><nodeprev 
automatic="on">Top</nodeprev><nodeup automatic="on">Top</nodeup></node>
 ';
 
 1;
diff --git a/tp/t/results/sectioning/part_node_after_top.pl 
b/tp/t/results/sectioning/part_node_after_top.pl
index 842c9f8136..d8a7f8c2a7 100644
--- a/tp/t/results/sectioning/part_node_after_top.pl
+++ b/tp/t/results/sectioning/part_node_after_top.pl
@@ -751,8 +751,8 @@ $result_converted{'xml'}->{'part_node_after_top'} = '<node 
name="Top" spaces=" "
 <menuentry><menuleadingtext>* </menuleadingtext><menunode>part node after 
top</menunode><menuseparator>::</menuseparator><menudescription><pre 
xml:space="preserve">
 </pre></menudescription></menuentry></menu>
 
-<node name="part-node-after-top" spaces=" "><nodename>part node after 
top</nodename><nodeprev automatic="on">Top</nodeprev><nodeup 
automatic="on">Top</nodeup></node>
 </top>
+<node name="part-node-after-top" spaces=" "><nodename>part node after 
top</nodename><nodeprev automatic="on">Top</nodeprev><nodeup 
automatic="on">Top</nodeup></node>
 <part spaces=" "><sectiontitle>part</sectiontitle>
 </part>
 ';
diff --git a/tp/t/results/sectioning/two_nodes_between_chapters.pl 
b/tp/t/results/sectioning/two_nodes_between_chapters.pl
index d1e55d238d..5b96f332ae 100644
--- a/tp/t/results/sectioning/two_nodes_between_chapters.pl
+++ b/tp/t/results/sectioning/two_nodes_between_chapters.pl
@@ -1383,9 +1383,9 @@ $result_converted{'xml'}->{'two_nodes_between_chapters'} 
= '<node name="Top" spa
 <node name="chapter-1" spaces=" "><nodename>chapter 1</nodename><nodenext 
spaces=" ">Top</nodenext><nodeprev spaces=" ">node between 
chapters</nodeprev><nodeup spaces=" ">Top</nodeup></node>
 <chapter spaces=" "><sectiontitle>chapter c1</sectiontitle>
 
+</chapter>
 <node name="node-between-chapters" spaces=" "><nodename>node between 
chapters</nodename><nodenext automatic="on">chapter 2</nodenext><nodeprev 
automatic="on">chapter 1</nodeprev><nodeup automatic="on">Top</nodeup></node>
 
-</chapter>
 <node name="chapter-2" spaces=" "><nodename>chapter 2</nodename><nodeprev 
automatic="on">chapter 1</nodeprev><nodeup automatic="on">Top</nodeup></node>
 <chapter spaces=" "><sectiontitle>chapter c2</sectiontitle>
 </chapter>



reply via email to

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