texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Joint tree transformation


From: Gavin D. Smith
Subject: branch master updated: Joint tree transformation
Date: Sat, 04 Jun 2022 10:52:10 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new bc5130c11d Joint tree transformation
bc5130c11d is described below

commit bc5130c11d2054a899472e63cf24d2ee36952a72
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Jun 4 15:52:01 2022 +0100

    Joint tree transformation
    
    * tp/Texinfo/Common.pm (html_joint_transformation):
    Peform both the 'move_index_entries_after_items' and the
    'relate_index_entries_to_table_entries_in_tree' transformations
    together.
    * tp/texi2any.pl: Use this for HTML and also LaTeX.
    
    This is much faster because of the slowness of recursively
    traversing the parse tree with Perl subroutine calls.  It means
    we traverse the tree one fewer time.
---
 ChangeLog            | 14 ++++++++++++++
 tp/Texinfo/Common.pm | 28 +++++++++++++++++++++++++++-
 tp/texi2any.pl       | 10 ++++++----
 3 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c82d33fda4..6ad032bff6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2022-06-04  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       Joint tree transformation
+
+       * tp/Texinfo/Common.pm (html_joint_transformation):
+       Peform both the 'move_index_entries_after_items' and the
+       'relate_index_entries_to_table_entries_in_tree' transformations
+       together.
+       * tp/texi2any.pl: Use this for HTML and also LaTeX.
+
+       This is much faster because of the slowness of recursively
+       traversing the parse tree with Perl subroutine calls.  It means
+       we traverse the tree one fewer time.
+
 2022-06-04  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_text):
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 4282084127..8ccfb763b2 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -2647,7 +2647,7 @@ sub _relate_index_entry_to_table_entry($)
   }
 }
 
-sub _relate_index_entries_to_table_entries_in_tree($$$)
+sub _relate_index_entries_to_table_entries_in_tree($$)
 {
   my ($type, $current) = @_;
 
@@ -2664,6 +2664,26 @@ sub relate_index_entries_to_table_entries_in_tree($)
                      \&_relate_index_entries_to_table_entries_in_tree);
 }
 
+sub _html_joint_transformation($)
+{
+  my $type = shift;
+  my $current = shift;
+
+  _move_index_entries_after_items($type, $current);
+  _relate_index_entries_to_table_entries_in_tree($type, $current);
+  return ($current);
+}
+
+# Peform both the 'move_index_entries_after_items' and the
+# 'relate_index_entries_to_table_entries_in_tree' transformations
+# together.  This is faster because the tree is only traversed once.
+sub html_joint_transformation($)
+{
+  my $tree = shift;
+  return modify_tree($tree, \&_html_joint_transformation);
+}
+
+
 # register a label, that is something that may be the target of a reference
 # and must be unique in the document.  Corresponds to @node, @anchor and
 # @float second arg.
@@ -3192,6 +3212,12 @@ In @*table @-commands, reassociate the index entry 
information from an index
 @-command appearing right after an @item line to the @item first element.
 Remove the index @-command from the tree.
 
+=item html_joint_transformation($tree)
+X<C<html_joint_transformation>>
+
+Do both C<relate_index_entries_to_table_entries_in_tree>
+and C<move_index_entries_after_items> together.
+
 =item $level = section_level($section)
 X<C<section_level>>
 
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 04e5d3c68e..46cebb3049 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -528,16 +528,14 @@ my %formats_table = (
              'split' => 1,
              'internal_links' => 1,
              'simple_menu' => 1,
-             'move_index_entries_after_items' => 1,
-             'relate_index_entries_to_table_entries' => 1,
+             'joint_transformation' => 1,
              'no_warn_non_empty_parts' => 1,
              'module' => 'Texinfo::Convert::HTML'
            },
   'latex' => {
              'floats' => 1,
              'internal_links' => 1,
-             'move_index_entries_after_items' => 1,
-             'relate_index_entries_to_table_entries' => 1,
+             'joint_transformation' => 1,
              'no_warn_non_empty_parts' => 1,
              'module' => 'Texinfo::Convert::LaTeX'
            },
@@ -1394,6 +1392,10 @@ while(@input_files) {
     Texinfo::Common::relate_index_entries_to_table_entries_in_tree($tree);
   }
 
+  if ($formats_table{$format}->{'joint_transformation'}) {
+    Texinfo::Common::html_joint_transformation($tree);
+  }
+
   if ($tree_transformations{'insert_nodes_for_sectioning_commands'}) {
     my ($modified_contents, $added_nodes)
      = Texinfo::Transformations::insert_nodes_for_sectioning_commands(



reply via email to

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