texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Structuring.pm (new_complete_menu_ma


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Structuring.pm (new_complete_menu_master_menu), tp/Texinfo/Convert/Plaintext.pm (_convert): move code setting up a menu and detailed menu if node is Top to Texinfo::Structuring as new_complete_menu_master_menu.
Date: Sat, 09 Sep 2023 05:20:02 -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 f43e522a16 * tp/Texinfo/Structuring.pm 
(new_complete_menu_master_menu), tp/Texinfo/Convert/Plaintext.pm (_convert): 
move code setting up a menu and detailed menu if node is Top to 
Texinfo::Structuring as new_complete_menu_master_menu.
f43e522a16 is described below

commit f43e522a16e8df350cbd1128d9947d015c3b878c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Sep 9 11:19:53 2023 +0200

    * tp/Texinfo/Structuring.pm (new_complete_menu_master_menu),
    tp/Texinfo/Convert/Plaintext.pm (_convert): move code setting up a
    menu and detailed menu if node is Top to Texinfo::Structuring
    as new_complete_menu_master_menu.
---
 ChangeLog                       |  7 +++++++
 tp/Texinfo/Convert/Plaintext.pm | 26 +++-----------------------
 tp/Texinfo/Structuring.pm       | 37 +++++++++++++++++++++++++++++++++++--
 3 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7d303eeaef..62bd5ce71f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-09-09  Patrice Dumas <pertusus@free.fr>
+
+       * tp/Texinfo/Structuring.pm (new_complete_menu_master_menu),
+       tp/Texinfo/Convert/Plaintext.pm (_convert): move code setting up a
+       menu and detailed menu if node is Top to Texinfo::Structuring
+       as new_complete_menu_master_menu.
+
 2023-09-08  Patrice Dumas <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Unicode.pm (string_width): remove explicit
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 6db99afdbb..f606a3fcfe 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -3833,29 +3833,9 @@ sub _convert($$)
       if ($node and $automatic_directions
             and !$self->{'seenmenus'}->{$node}) {
         $self->{'seenmenus'}->{$node} = 1;
-        my $menu_node;
-        $menu_node = Texinfo::Structuring::new_complete_node_menu($node);
-        if ($command eq 'top' and $menu_node
-             and $node->{'extra'}->{'normalized'} eq 'Top') {
-          my $detailmenu = Texinfo::Structuring::new_master_menu($self,
-                                                        $self->{'labels'},
-                                                        [ $menu_node ]);
-          if ($detailmenu) {
-            # add a blank line before the detailed node listing
-            my $menu_comment = {'type' => 'menu_comment',
-                                'parent' => $menu_node};
-            push @{$menu_node->{'contents'}}, $menu_comment;
-            my $preformatted = {'type' => 'preformatted',
-                                'parent' => $menu_comment};
-            push @{$menu_comment->{'contents'}}, $preformatted;
-            my $empty_line = {'type' => 'after_menu_description_line',
-                              'text' => "\n", 'parent' => $preformatted};
-            push @{$preformatted->{'contents'}}, $empty_line;
-
-            $detailmenu->{'parent'} = $menu_node;
-            push @{$menu_node->{'contents'}}, $detailmenu;
-          }
-        }
+        my $menu_node
+         = Texinfo::Structuring::new_complete_menu_master_menu($self,
+                                             $self->{'labels'}, $node);
         if ($menu_node) {
           my $menu_text = $self->_convert($menu_node);
           if ($menu_text) {
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 03817f5226..a70aaa3f09 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1837,6 +1837,38 @@ sub new_master_menu($$$)
   }
 }
 
+# TODO document
+sub new_complete_menu_master_menu($$$)
+{
+  my $self = shift;
+  my $labels = shift;
+  my $node = shift;
+
+  my $menu_node = new_complete_node_menu($node);
+  if ($node->{'extra'}->{'normalized'} eq 'Top'
+      and $node->{'extra'}->{'associated_section'}
+      and $node->{'extra'}->{'associated_section'}->{'cmdname'} eq 'top'
+      and $menu_node) {
+    my $detailmenu = new_master_menu($self, $labels, [$menu_node]);
+    if ($detailmenu) {
+      # add a blank line before the detailed node listing
+      my $menu_comment = {'type' => 'menu_comment',
+                          'parent' => $menu_node};
+      push @{$menu_node->{'contents'}}, $menu_comment;
+      my $preformatted = {'type' => 'preformatted',
+                          'parent' => $menu_comment};
+      push @{$menu_comment->{'contents'}}, $preformatted;
+      my $empty_line = {'type' => 'after_menu_description_line',
+                        'text' => "\n", 'parent' => $preformatted};
+      push @{$preformatted->{'contents'}}, $empty_line;
+
+      $detailmenu->{'parent'} = $menu_node;
+      push @{$menu_node->{'contents'}}, $detailmenu;
+    }
+  }
+  return $menu_node;
+}
+
 sub _print_down_menus($$);
 sub _print_down_menus($$)
 {
@@ -2558,12 +2590,13 @@ Returns a texinfo tree menu for node I<$node>, pointing 
to the children
 of the node obtained with the sectioning structure.  If I<$use_sections>
 is set, use section names for the menu entry names.
 
-=item $detailmenu = new_master_menu($translations, $labels)
+=item $detailmenu = new_master_menu($translations, $labels, $menus)
 X<C<new_master_menu>>
 
 Returns a detailmenu tree element formatted as a master node.
 I<$translations>, if defined, should be a L<Texinfo::Translations> object and
-should also hold customization information.
+should also hold customization information. I<$menus> is an array
+reference containing the regular menus of the Top node.
 
 =item $entry = new_node_menu_entry($node, $use_sections)
 X<C<new_node_menu_entry>>



reply via email to

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