texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: LaTeX.pm: keep lone nodes.


From: Patrice Dumas
Subject: branch master updated: LaTeX.pm: keep lone nodes.
Date: Sun, 15 Aug 2021 18:22:13 -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 7098d6a  LaTeX.pm: keep lone nodes.
7098d6a is described below

commit 7098d6a75354f72aff638198278e1d13e7ce2f73
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Aug 16 00:21:31 2021 +0200

    LaTeX.pm: keep lone nodes.
---
 tp/Texinfo/Convert/LaTeX.pm                             | 17 +++++++++++++----
 tp/t/30sectioning.t                                     |  2 --
 .../sectioning/loop_nodes/res_latex/loop_nodes.tex      |  7 +++++++
 .../res_latex/nodes_before_after_top.tex                |  4 ++++
 .../section_before_after_top_node_last_node.tex         |  1 +
 5 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 3f8d0d7..46941de 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -826,8 +826,12 @@ sub output($$)
   #$result .= $self->convert_document_sections($root, $fh);
   my $elements = Texinfo::Structuring::split_by_section($root);
   if ($elements) {
-    # Check if the document ends with a lone Top node, that
-    # will be ignored
+    # Ignore everything between Top node and the next node.  If
+    # at the end mark that Top node is ignored.
+    # After those manipulations, the tree should be incorrect,
+    # as element should point to original sections and sections
+    # to original elements.  This structure is not used in the
+    # LaTeX conversion code, though.
     my $converted_elements = [];
     my $current_modified_element;
     my $in_top_node = 0;
@@ -862,7 +866,13 @@ sub output($$)
               }
             }
           } else {
-            $in_top_node = 0;
+            if ($in_top_node) {
+              $in_top_node = 0;
+            }
+            if ($current_modified_element) {
+              push @{$current_modified_element->{'contents'}},
+                $element_content;
+            }
           }
         } elsif (not $in_top_node) {
           if ($current_modified_element) {
@@ -1695,7 +1705,6 @@ sub _convert($$)
         }
       }
     } elsif ($command eq 'node') {
-      $self->{'node'} = $root;
       # add the label only if not associated with a section
       if (not $root->{'extra'}->{'associated_section'}) {
         my $node_label
diff --git a/tp/t/30sectioning.t b/tp/t/30sectioning.t
index e083857..76424d8 100644
--- a/tp/t/30sectioning.t
+++ b/tp/t/30sectioning.t
@@ -865,7 +865,6 @@ section.
 
 @contents
 ', {}, {'CONTENTS_OUTPUT_LOCATION' => 'inline'}],
-# FIXME in LaTeX @node node after is missing
 ['section_before_after_top_node_last_node',
 '@setfilename section_before_after_top_node_last_node.info
 
@@ -1830,7 +1829,6 @@ Second top.
 @node second node
 @chapter a chapter
 '],
-# FIXME in LaTeX "in node after" is missing
 ['nodes_before_after_top',
 '@setfilename nodes_before_after_top.info
 
diff --git a/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex 
b/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex
index c916a18..616e2bc 100644
--- a/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex
+++ b/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex
@@ -56,4 +56,11 @@
 
 \begin{document}
 
+\label{anchor:node-up}%
+
+
+\label{anchor:node-middle}%
+
+
+\label{anchor:node-down}%
 \end{document}
diff --git 
a/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
 
b/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
index 3ba9f91..094137d 100644
--- 
a/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
+++ 
b/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
@@ -60,6 +60,10 @@
 
 In node before
 
+\label{anchor:after}%
+
+in node after
+
 \chapter{chap}
 \label{anchor:chap}%
 
diff --git 
a/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
 
b/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
index e916548..e6efa83 100644
--- 
a/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
+++ 
b/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
@@ -58,4 +58,5 @@
 
 \chapter*{before}
 
+\label{anchor:node-after}%
 \end{document}



reply via email to

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