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 (_begin_document, _


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_begin_document, _convert): output contents after the beginning of document unless if CONTENTS_OUTPUT_LOCATION is set to inline in which case it is output where contents is (could be in the preamble...).
Date: Sun, 02 Jan 2022 12:27:10 -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 5d9cdb771c * tp/Texinfo/Convert/LaTeX.pm (_begin_document, _convert): 
output contents after the beginning of document unless if 
CONTENTS_OUTPUT_LOCATION is set to inline in which case it is output where 
contents is (could be in the preamble...).
5d9cdb771c is described below

commit 5d9cdb771c6fa708cfe6319abff3780a4bf92ff8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jan 2 18:27:00 2022 +0100

    * tp/Texinfo/Convert/LaTeX.pm (_begin_document, _convert): output
    contents after the beginning of document unless if CONTENTS_OUTPUT_LOCATION
    is set to inline in which case it is output where contents is (could
    be in the preamble...).
---
 ChangeLog                                          |  7 +++++++
 tp/Texinfo/Convert/LaTeX.pm                        | 22 ++++++++++++++++++----
 .../res_parser/formatting_latex/formatting.tex     |  2 +-
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 403483b943..05ef337e42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-01-02  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/LaTeX.pm (_begin_document, _convert): output
+       contents after the beginning of document unless if 
CONTENTS_OUTPUT_LOCATION
+       is set to inline in which case it is output where contents is (could
+       be in the preamble...).
+
 2022-01-02  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/LaTeX.pm (output): add a preamble element
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index b99618fdd3..5f77c5447a 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -240,7 +240,7 @@ my %preamble_commands = %Texinfo::Common::preamble_commands;
 
 foreach my $kept_command (keys(%informative_commands),
   keys(%default_index_commands),
-  keys(%headings_specification_commands), keys(%in_heading_commands),
+  keys(%in_heading_commands),
   keys(%formattable_misc_commands),
   'indent', 'noindent') {
   $formatted_misc_commands{$kept_command} = 1;
@@ -924,7 +924,7 @@ sub output($$)
 
   # Ignore everything between Top node and the next node.
   # TODO find a way to process informative commands as TeX does
-  my $modified_root = {'contents' => []};
+  my $modified_root = {'contents' => [], 'type' => $root->{'type'}};
 
   my $in_top_node = 0;
   foreach my $element_content (@{$root->{'contents'}}) {
@@ -1328,6 +1328,16 @@ sub _begin_document($)
     $result .= "\\GNUTexinfomainmatter\n";
     $self->{'titlepage_done'} = 1;
   }
+
+  if (exists($self->{'global_commands'}->{'contents'})
+      and $self->{'structuring'}
+      and $self->{'structuring'}->{'sectioning_root'}
+      and not (defined($self->get_conf('CONTENTS_OUTPUT_LOCATION'))
+               and $self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'inline')) {
+    $result .= "\\tableofcontents\\newpage\n";
+  }
+
+
   return $result;
 }
 
@@ -2927,8 +2937,10 @@ sub _convert($$)
       }
       return $result;
     } elsif ($cmdname eq 'contents') {
-      if ($self->{'structuring'}
-            and $self->{'structuring'}->{'sectioning_root'}) {
+      if (defined($self->get_conf('CONTENTS_OUTPUT_LOCATION'))
+          and $self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'inline'
+          and $self->{'structuring'}
+          and $self->{'structuring'}->{'sectioning_root'}) {
         $result .= "\\tableofcontents\\newpage\n";
       }
       return $result;
@@ -2955,7 +2967,9 @@ sub _convert($$)
     # in a way that can be reverted as with @firstparagraphindent.
     # use of \usepackage{indentfirst} cannot be reverted.
     } elsif ($informative_commands{$cmdname}) {
+
       $self->set_informative_command_value($element);
+
       if ($cmdname eq 'documentlanguage') {
         my $language = $self->get_conf('documentlanguage');
         $language =~ s/_/-/;
diff --git a/tp/tests/layout/res_parser/formatting_latex/formatting.tex 
b/tp/tests/layout/res_parser/formatting_latex/formatting.tex
index 2d366e62e0..17afcfbf8d 100644
--- a/tp/tests/layout/res_parser/formatting_latex/formatting.tex
+++ b/tp/tests/layout/res_parser/formatting_latex/formatting.tex
@@ -2468,6 +2468,7 @@ Various deff lines
 \end{titlepage}
 \GNUTexinfosetsingleheader{}%
 \GNUTexinfomainmatter
+\tableofcontents\newpage
 
 
 
@@ -6089,5 +6090,4 @@ tp
 \printindex[cp]
 \printindex[fn]
 
-\tableofcontents\newpage
 \end{document}



reply via email to

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