texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Transformations.pm (_prepend_new_men


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Transformations.pm (_prepend_new_menu_in_node_section): set menu parent.
Date: Sun, 29 Sep 2024 09:16:01 -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 5b19d1f74b * tp/Texinfo/Transformations.pm 
(_prepend_new_menu_in_node_section): set menu parent.
5b19d1f74b is described below

commit 5b19d1f74b7e16403b3f63ccb714bf6f6d8838ab
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jun 29 22:47:41 2024 +0200

    * tp/Texinfo/Transformations.pm (_prepend_new_menu_in_node_section):
    set menu parent.
    
    * tp/Texinfo/Structuring.pm (new_complete_node_menu),
    tp/Texinfo/XS/structuring_transfo/structuring.c
    (new_complete_node_menu): do not set new menu parent, it is better to
    set it downstream, as in many case there should not be a parent.
    
    Add const.
---
 ChangeLog                                       | 12 ++++++++++++
 tp/Texinfo/Structuring.pm                       |  5 ++++-
 tp/Texinfo/Transformations.pm                   |  1 +
 tp/Texinfo/XS/structuring_transfo/structuring.c |  7 +++----
 4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7c5786194b..e0a1ef5f59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-06-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Transformations.pm (_prepend_new_menu_in_node_section):
+       set menu parent.
+
+       * tp/Texinfo/Structuring.pm (new_complete_node_menu),
+       tp/Texinfo/XS/structuring_transfo/structuring.c
+       (new_complete_node_menu): do not set new menu parent, it is better to
+       set it downstream, as in many case there should not be a parent.
+
+       Add const.
+
 2024-06-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/build_perl_info.c (build_additional_info),
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index f731b6973f..87cce4f97e 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1348,7 +1348,7 @@ sub new_complete_node_menu
   # only holds contents here, will be turned into a proper block
   # command in new_block_command below
   my $section = $node->{'extra'}->{'associated_section'};
-  my $new_menu = {'contents' => [], 'parent' => $section};
+  my $new_menu = {'contents' => []};
   foreach my $child (@node_childs) {
     my $entry = new_node_menu_entry($child, $use_sections);
     if (defined($entry)) {
@@ -1505,6 +1505,7 @@ sub new_complete_menu_master_menu($$$)
   return $menu_node;
 }
 
+# returns menu contents
 sub _print_down_menus($$$$$;$);
 sub _print_down_menus($$$$$;$)
 {
@@ -1515,6 +1516,8 @@ sub _print_down_menus($$$$$;$)
   my $identifier_target = shift;
   my $use_sections = shift;
 
+  # NOTE the menus are not used directly, the entry of the menus are copied
+  # and returned in @master_menu_contents.
   my @menus;
 
   my @master_menu_contents;
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 2f4aec040d..7fd470b470 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -511,6 +511,7 @@ sub _prepend_new_menu_in_node_section($$$)
     cluck "input menu undef";
   }
   push @{$section->{'contents'}}, $current_menu;
+  $current_menu->{'parent'} = $section;
   push @{$section->{'contents'}}, {'type' => 'empty_line',
                                    'text' => "\n",
                                    'parent' => $section};
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c 
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index 4d865046ab..e70ecc65e5 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -973,7 +973,7 @@ set_menus_node_directions (DOCUMENT *document)
 static enum ai_key_name direction_bases[] = {AI_key_section_directions,
                                              AI_key_toplevel_directions};
 
-static ELEMENT *
+static const ELEMENT *
 section_direction_associated_node (const ELEMENT *section,
                                    enum directions direction)
 {
@@ -986,7 +986,7 @@ section_direction_associated_node (const ELEMENT *section,
       if (directions && directions[direction])
         {
           const ELEMENT *section_to = directions[direction];
-          ELEMENT *associated_node = lookup_extra_element (section_to,
+          const ELEMENT *associated_node = lookup_extra_element (section_to,
                                                     AI_key_associated_node);
           if ((direction_bases[i] != AI_key_toplevel_directions
                || direction == D_up
@@ -1831,7 +1831,7 @@ new_complete_node_menu (const ELEMENT *node, DOCUMENT 
*document,
 {
   CONST_ELEMENT_LIST *node_childs
     = get_node_node_childs_from_sectioning (node);
-  ELEMENT *section;
+  const ELEMENT *section;
   ELEMENT *new_menu;
   int i;
 
@@ -1846,7 +1846,6 @@ new_complete_node_menu (const ELEMENT *node, DOCUMENT 
*document,
 
   section = lookup_extra_element (node, AI_key_associated_section);
   new_menu = new_command_element (ET_block_command, CM_menu);
-  new_menu->parent = section;
 
   for (i = 0; i < node_childs->number; i++)
     {



reply via email to

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