texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/LaTeX.pm (output): do not ad


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/LaTeX.pm (output): do not add a preamble if there is none. The tree used should already contain a preamble if needed.
Date: Sun, 09 Jan 2022 20:19:41 -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 f266ff1bbc * tp/Texinfo/Convert/LaTeX.pm (output): do not add a 
preamble if there is none.  The tree used should already contain a preamble if 
needed.
f266ff1bbc is described below

commit f266ff1bbcf8d6a0e1a16a2de2ad82041cb8eb02
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jan 10 02:19:31 2022 +0100

    * tp/Texinfo/Convert/LaTeX.pm (output): do not add a preamble
    if there is none.  The tree used should already contain a
    preamble if needed.
---
 ChangeLog                   |  6 ++++++
 tp/Texinfo/Convert/LaTeX.pm | 42 ++----------------------------------------
 2 files changed, 8 insertions(+), 40 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bc540a8ac9..c19ebe9672 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-01-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/LaTeX.pm (output): do not add a preamble
+       if there is none.  The tree used should already contain a
+       preamble if needed.
+
 2022-01-09  Patrice Dumas  <pertusus@free.fr>
 
        * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 51f32d293f..73a38d6746 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -888,7 +888,8 @@ sub associate_other_nodes_to_sections($$)
 }
 
 # mark in the tree where the \begin{document} should be,
-# after the @-commands in preamble
+# after the @-commands in preamble.  It is not setup
+# when using parse_texi_piece only.
 my $latex_document_type = 'preamble_before_content';
 
 sub output($$)
@@ -914,47 +915,8 @@ sub output($$)
     }
   }
 
-  # FIXME is it a good thing to redo what could have been done after the
-  # parsing?  Should the preamble be setup after parse_texi_piece() too?
-  #
-  # check if preamble is already present and determine at which index it should
-  # be inserted.  Preamble is not set if parser was called with 
parse_texi_piece().
-  # We do not use Texinfo::Common::add_preamble_before_content as we already
-  # have the location as a side effect of checking if the preamble is there, 
and we do
-  # not seet a container for the preamble but simply add a marker, with less
-  # changes to the tree.
-  my $inserted_preamble_idx = -1;
-  foreach my $content (@{$root->{'contents'}->[0]->{'contents'}}) {
-    $inserted_preamble_idx++;
-    if ($content->{'type'}) {
-      if ($content->{'type'} eq $latex_document_type) {
-        $inserted_preamble_idx = undef;
-        last;
-      } elsif ($content->{'type'} eq 'paragraph') {
-        $inserted_preamble_idx--;
-        last;
-      }
-    }
-    if ($content->{'cmdname'} and not 
$preamble_commands{$content->{'cmdname'}}) {
-      $inserted_preamble_idx--;
-      last;
-    }
-  }
-
   my $modified_root;
 
-  if (defined($inserted_preamble_idx)) {
-    print STDERR "INSERT $latex_document_type: $inserted_preamble_idx\n"
-      if ($self->get_conf('DEBUG'));
-    $modified_root = {'contents' => [ @{$root->{'contents'}} ], 'type' => 
$root->{'type'}};
-    my $new_before_node_section = {'type' => 
$modified_root->{'contents'}->[0]->{'type'},
-                                   'parent' => $modified_root,
-            'contents' => [ @{$modified_root->{'contents'}->[0]->{'contents'}} 
]};
-    splice @{$new_before_node_section->{'contents'}}, $inserted_preamble_idx 
+1, 0, 
-        {'type' => $latex_document_type, 'parent' => $new_before_node_section};
-    $modified_root->{'contents'}->[0] = $new_before_node_section;
-  }
-
   # determine if there is a Top node at the end of the document
   my $in_top_node = undef;
   foreach my $element_content (@{$root->{'contents'}}) {



reply via email to

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