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 (set_menus_node_direc


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Structuring.pm (set_menus_node_directions) (nodes_tree, _section_direction_associated_node), (_complete_check_menus_directions): separate set_menus_node_directions() and _complete_check_menus_directions() from nodes_tree() to distinguish better code related to menus and not related to menus. Add _section_direction_associated_node() as a small helper function from node_tree too to be able to reuse the code. * tp/t/test_utils.pl, tp/texi2any.pl: call set_menus_node_directions. [...]
Date: Mon, 22 Feb 2021 07:48:08 -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 bf668f0  * tp/Texinfo/Structuring.pm (set_menus_node_directions) 
(nodes_tree, _section_direction_associated_node), 
(_complete_check_menus_directions): separate set_menus_node_directions() and 
_complete_check_menus_directions() from nodes_tree() to distinguish better code 
related to menus and not related to menus.  Add 
_section_direction_associated_node() as a small helper function from node_tree 
too to be able to reuse the code. * tp/t/test_utils.pl, tp/texi2any.pl: call 
set_menu [...]
bf668f0 is described below

commit bf668f0928f546bf8b688dae4bf2635e1da29063
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Feb 22 13:47:59 2021 +0100

    * tp/Texinfo/Structuring.pm (set_menus_node_directions)
    (nodes_tree, _section_direction_associated_node),
    (_complete_check_menus_directions): separate
    set_menus_node_directions() and _complete_check_menus_directions()
    from nodes_tree() to distinguish better code related to menus
    and not related to menus.  Add _section_direction_associated_node()
    as a small helper function from node_tree too to be able to reuse
    the code.
    * tp/t/test_utils.pl, tp/texi2any.pl: call
    set_menus_node_directions.
    * tp/Texinfo/Structuring.pm (nodes_tree): set Top node next
    using the sectioning structure first.  Avoid resetting node directions
    based on Top node first menu entry the direction was already set.
---
 ChangeLog                                          |  16 ++
 tp/Texinfo/Structuring.pm                          | 258 ++++++++++++++-------
 tp/t/results/moreindices/index_split.pl            | 187 +++++++++++++--
 tp/t/results/moreindices/index_split_nodes.pl      | 178 +++++++++++++-
 .../sectioning/section_chapter_before_top_nodes.pl |   8 +-
 tp/t/test_utils.pl                                 |   1 +
 tp/texi2any.pl                                     |   1 +
 7 files changed, 538 insertions(+), 111 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d118fd2..da7755b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2021-02-22  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Structuring.pm (set_menus_node_directions)
+       (nodes_tree, _section_direction_associated_node), 
+       (_complete_check_menus_directions): separate
+       set_menus_node_directions() and _complete_check_menus_directions()
+       from nodes_tree() to distinguish better code related to menus
+       and not related to menus.  Add _section_direction_associated_node()
+       as a small helper function from node_tree too to be able to reuse 
+       the code.
+       * tp/t/test_utils.pl, tp/texi2any.pl: call
+       set_menus_node_directions.
+       * tp/Texinfo/Structuring.pm (nodes_tree): set Top node next
+       using the sectioning structure first.  Avoid resetting node directions
+       based on Top node first menu entry the direction was already set.
+
 2021-02-21  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (nodes_tree): use first non Top node
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index bf93de6..f0a84d7 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -51,6 +51,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
   nodes_tree
   number_floats
   sectioning_structure
+  set_menus_node_directions
   sort_indices
   sort_indices_by_letter
   split_by_node
@@ -445,12 +446,11 @@ sub _check_referenced_nodes
   }
 }
 
-# set node and menu directions, and check consistency
-sub nodes_tree($)
+# set menu directions
+sub set_menus_node_directions($)
 {
   my $self = shift;
   return undef unless ($self->{'nodes'} and @{$self->{'nodes'}});
-  my $top_node;
 
   my $check_menu_entries = (!$self->{'info'}->{'novalidate'}
                       and $self->get_conf('FORMAT_MENU') eq 'menu');
@@ -530,13 +530,40 @@ sub nodes_tree($)
       }
     }
   }
+}
 
-  # Go through all the nodes and set directions.
-  foreach my $node (@{$self->{'nodes'}}) {
-    if ($node->{'extra'}->{'normalized'} eq 'Top') {
-      $top_node = $node;
+# determine node found through section directions, usually
+# from section_$direction.  It could also be from
+# toplevel_$direction if going through parts, except for @top
+# as prev or next.
+sub _section_direction_associated_node($$)
+{
+  my $section = shift;
+  my $direction = shift;
+
+  foreach my $direction_base ('section', 'toplevel') {
+    if ($section->{$direction_base.'_'.$direction}
+       and $section->{$direction_base.'_'.$direction}->{'extra'}
+       and ($direction_base ne 'toplevel'
+            or $direction eq 'up'
+            or $section->{$direction_base.'_'.$direction}->{'cmdname'} ne 
'top')
+       and 
$section->{$direction_base.'_'.$direction}->{'extra'}->{'associated_node'}) {
+         return 
$section->{$direction_base.'_'.$direction}->{'extra'}->{'associated_node'};
     }
-    my $automatic_directions = 
+  }
+  return undef;
+}
+
+# complete automatic directions with menus (and first node
+# for Top node).
+# Checks on structure related to menus.
+sub _complete_check_menus_directions($)
+{
+  my $self = shift;
+  return undef unless ($self->{'nodes'} and @{$self->{'nodes'}});
+  # Go through all the nodes
+  foreach my $node (@{$self->{'nodes'}}) {
+    my $automatic_directions =
       (scalar(@{$node->{'extra'}->{'nodes_manuals'}}) == 1);
 
     if ($automatic_directions) {
@@ -556,24 +583,10 @@ sub nodes_tree($)
             if ($section->{'extra'}->{'part_associated_section'}) {
               $section = $section->{'extra'}->{'part_associated_section'};
             }
-            # Set node_$direction, usually from section_$direction.
-            # 'toplevel' is to go through parts, except for @top as prev
-            # or next.
-            foreach my $direction_base ('section', 'toplevel') {
-              if ($section->{$direction_base.'_'.$direction}
-                 and $section->{$direction_base.'_'.$direction}->{'extra'}
-                 and ($direction_base ne 'toplevel'
-                      or $direction eq 'up'
-                      or 
$section->{$direction_base.'_'.$direction}->{'cmdname'} ne 'top')
-                 and 
$section->{$direction_base.'_'.$direction}->{'extra'}->{'associated_node'}) {
-                $node->{'node_'.$direction} 
-                  = 
$section->{$direction_base.'_'.$direction}->{'extra'}->{'associated_node'};
-                last;
-              }
-            }
-            # If set, a direction was found using sections.  Check consistency
-            # with menus.
-            if ($node->{'node_'.$direction}) {
+            # Check consistency with section and menu structure
+            my $direction_associated_node
+              = _section_direction_associated_node($section, $direction);
+            if ($direction_associated_node) {
               if ($self->get_conf('CHECK_NORMAL_MENU_STRUCTURE')) {
                 if ($section->{'section_up'}{'extra'}
           and $section->{'section_up'}{'extra'}{'associated_node'}
@@ -581,10 +594,10 @@ sub nodes_tree($)
           and @{$section->{'section_up'}{'extra'}{'associated_node'}{'menus'}}
                     and !$node->{'menu_'.$direction}) {
                   $self->line_warn(sprintf(
-               __("node %s for `%s' is `%s' in sectioning but not in menu"), 
+               __("node %s for `%s' is `%s' in sectioning but not in menu"),
                   $direction,
                   node_extra_to_texi($node->{'extra'}),
-                  node_extra_to_texi($node->{'node_'.$direction}->{'extra'})), 
+                  node_extra_to_texi($direction_associated_node->{'extra'})),
                     $node->{'line_nr'});
                 }
               }
@@ -602,19 +615,19 @@ sub nodes_tree($)
                   __("node `%s' is %s for `%s' in menu but not in sectioning"),
                 node_extra_to_texi($node->{'menu_'.$direction}->{'extra'}),
                                    $direction,
-                node_extra_to_texi($node->{'extra'}), 
-                  ), 
+                node_extra_to_texi($node->{'extra'}),
+                  ),
                 $node->{'line_nr'});
             }
             $node->{'node_'.$direction} = $node->{'menu_'.$direction};
           }
         }
-      } else {
-        # Special case for Top node.
+      } elsif (not $node->{'node_next'}) {
         # use first menu entry if available as next for Top
         if ($node->{'menu_child'}) {
           $node->{'node_next'} = $node->{'menu_child'};
-          if (!$node->{'menu_child'}->{'extra'}->{'manual_content'}) {
+          if (!$node->{'menu_child'}->{'extra'}->{'manual_content'}
+              and !$node->{'menu_child'}->{'node_prev'}) {
             $node->{'menu_child'}->{'node_prev'} = $node;
           }
         } else {
@@ -630,6 +643,104 @@ sub nodes_tree($)
           }
         }
       }
+    }
+    # check consistency between node pointer and node entries menu order
+    if ($node->{'extra'}->{'normalized'} ne 'Top') {
+      foreach my $direction (@node_directions) {
+        if ($self->get_conf('CHECK_NORMAL_MENU_STRUCTURE')
+            and $node->{'node_'.$direction}
+            and $node->{'menu_'.$direction}
+            and $node->{'menu_'.$direction}
+               ne $node->{'node_'.$direction}
+            and not 
$node->{'menu_'.$direction}->{'extra'}->{'manual_content'}) {
+          $self->line_warn(sprintf(
+           __("node %s pointer for `%s' is `%s' but %s is `%s' in menu"),
+                  $direction,
+                  node_extra_to_texi($node->{'extra'}),
+                  node_extra_to_texi($node->{'node_'.$direction}->{'extra'}),
+                  $direction,
+                  node_extra_to_texi($node->{'menu_'.$direction}->{'extra'})),
+                 $node->{'line_nr'});
+        }
+      }
+    }
+
+    # check for node up / menu up mismatch
+    if ($self->get_conf('CHECK_NORMAL_MENU_STRUCTURE')
+        and $node->{'node_up'}
+        # No check if node up is an external manual
+        and (!$node->{'node_up'}->{'extra'}->{'manual_content'})
+        and (!$node->{'menu_up_hash'}
+          or 
!$node->{'menu_up_hash'}->{$node->{'node_up'}->{'extra'}->{'normalized'}})) {
+      # check if up node has a menu
+      if ($node->{'node_up'}->{'menus'} and @{$node->{'node_up'}->{'menus'}}) {
+        $self->line_warn(sprintf(
+           __("node `%s' lacks menu item for `%s' despite being its Up 
target"), 
+           node_extra_to_texi($node->{'node_up'}->{'extra'}), 
+           node_extra_to_texi($node->{'extra'})),
+           $node->{'node_up'}->{'line_nr'});
+      }
+      # FIXME check that the menu_up_hash is not empty (except for Top)?
+      # FIXME check that node_up is not an external node (except for Top)?
+    }
+  }
+}
+
+
+# set node directions based on sectioning and @node explicit directions
+sub nodes_tree($)
+{
+  my $self = shift;
+  return undef unless ($self->{'nodes'} and @{$self->{'nodes'}});
+
+  my $top_node;
+  # Go through all the nodes and set directions.
+  foreach my $node (@{$self->{'nodes'}}) {
+    if ($node->{'extra'}->{'normalized'} eq 'Top') {
+      $top_node = $node;
+    }
+    my $automatic_directions = 
+      (scalar(@{$node->{'extra'}->{'nodes_manuals'}}) == 1);
+
+    if ($automatic_directions) {
+      if ($node->{'extra'}->{'normalized'} ne 'Top') {
+        foreach my $direction (@node_directions) {
+          # prev already defined for the node first Top node menu entry
+          if ($direction eq 'prev' and $node->{'node_'.$direction}
+              and $node->{'node_'.$direction}->{'extra'}
+              and $node->{'node_'.$direction}->{'extra'}->{'normalized'}
+              and $node->{'node_'.$direction}->{'extra'}->{'normalized'} eq 
'Top') {
+            next;
+          }
+          if ($node->{'extra'}->{'associated_section'}) {
+            my $section = $node->{'extra'}->{'associated_section'};
+
+            # Prefer the section associated with a @part for node directions.
+            if ($section->{'extra'}->{'part_associated_section'}) {
+              $section = $section->{'extra'}->{'part_associated_section'};
+            }
+
+            my $direction_associated_node
+              = _section_direction_associated_node($section, $direction);
+            if ($direction_associated_node) {
+              $node->{'node_'.$direction} = $direction_associated_node;
+            }
+          }
+        }
+      } else {
+        # Special case for Top node, use first section
+        if ($node->{'extra'}->{'associated_section'}
+            and $node->{'extra'}->{'associated_section'}->{'section_childs'}
+            and 
$node->{'extra'}->{'associated_section'}->{'section_childs'}->[0]
+            and 
$node->{'extra'}->{'associated_section'}->{'section_childs'}->[0]->{'extra'}->{'associated_node'})
 {
+          my $top_node_section_child
+            = 
$node->{'extra'}->{'associated_section'}->{'section_childs'}->[0]->{'extra'}->{'associated_node'};
+          $node->{'node_next'} = $top_node_section_child;
+          if (scalar(@{$top_node_section_child->{'extra'}->{'nodes_manuals'}}) 
== 1) {
+            $top_node_section_child->{'node_prev'} = $node;
+          }
+        }
+      }
     } else { # explicit directions
       my @directions = @{$node->{'extra'}->{'nodes_manuals'}};
       shift @directions;
@@ -670,58 +781,12 @@ sub nodes_tree($)
         }
       }
     }
-    # check consistency between node pointer and node entries menu order
-    if ($node->{'extra'}->{'normalized'} ne 'Top') {
-      foreach my $direction (@node_directions) {
-        if ($self->get_conf('CHECK_NORMAL_MENU_STRUCTURE')
-            and $node->{'node_'.$direction}
-            and $node->{'menu_'.$direction}
-            and $node->{'menu_'.$direction}
-               ne $node->{'node_'.$direction}
-            and not 
$node->{'menu_'.$direction}->{'extra'}->{'manual_content'}) {
-          $self->line_warn(sprintf(
-           __("node %s pointer for `%s' is `%s' but %s is `%s' in menu"),
-                  $direction,
-                  node_extra_to_texi($node->{'extra'}),
-                  node_extra_to_texi($node->{'node_'.$direction}->{'extra'}),
-                  $direction,
-                  node_extra_to_texi($node->{'menu_'.$direction}->{'extra'})),
-                 $node->{'line_nr'});
-        }
-      }
-    }
-
-    # check for node up / menu up mismatch
-    if ($self->get_conf('CHECK_NORMAL_MENU_STRUCTURE')
-        and $node->{'node_up'}
-        # No check if node up is an external manual
-        and (!$node->{'node_up'}->{'extra'}->{'manual_content'})
-        and (!$node->{'menu_up_hash'}
-          or 
!$node->{'menu_up_hash'}->{$node->{'node_up'}->{'extra'}->{'normalized'}})) {
-      # check if up node has a menu
-      if ($node->{'node_up'}->{'menus'} and @{$node->{'node_up'}->{'menus'}}) {
-        $self->line_warn(sprintf(
-           __("node `%s' lacks menu item for `%s' despite being its Up 
target"), 
-           node_extra_to_texi($node->{'node_up'}->{'extra'}), 
-           node_extra_to_texi($node->{'extra'})),
-           $node->{'node_up'}->{'line_nr'});
-      } #elsif ($node->{'menu_up'}) {
-        # check unneeded as mismatch between node and menu directions
-        # already done just above
-        ## check if node is listed in a different menu
-        #$self->line_warn(sprintf(
-        #   __("for `%s', up in menu `%s' and up `%s' don't match"), 
-        #  node_extra_to_texi($node->{'extra'}),
-        #  node_extra_to_texi($node->{'menu_up'}->{'extra'}), 
-        #  node_extra_to_texi($node->{'node_up'}->{'extra'})),
-        #                $node->{'line_nr'});
-      #}
-      # FIXME check that the menu_up_hash is not empty (except for Top)?
-      # FIXME check that node_up is not an external node (except for Top)?
-    }
   }
   $top_node = $self->{'nodes'}->[0] if (!$top_node);
   $self->{'structuring'}->{'top_node'} = $top_node;
+
+  _complete_check_menus_directions($self);
+
   if ($self->get_conf('FORMAT_MENU') ne 'sectiontoc') {
     _check_referenced_nodes($self, $top_node);
   }
@@ -1644,6 +1709,7 @@ Texinfo::Structuring - information on Texinfo::Parser tree
     elements_file_directions);
   # $tree is a Texinfo document tree.  $parser is a Texinfo::Parser object.
   my $sections_root = sectioning_structure ($parser, $tree);
+  set_menus_node_directions($parser);
   my $top_node = nodes_tree($parser);
   number_floats($parser->floats_information());
   associate_internal_references($parser);
@@ -1675,9 +1741,11 @@ Texinfo::Structuring - information on Texinfo::Parser 
tree
 Texinfo::Structuring first allows to collect informations on a Texinfo tree.
 In most case, it also requires a parser object to do that job.  Thanks to
 C<sectioning_structure> the hierarchy of sectioning commands is determined.
-The node and menus tree is analysed with C<nodes_tree>.  Floats get their 
-standard numbering with C<number_floats> and internal references are matched
-up with nodes, floats or anchors with C<associate_internal_references>.
+The directions implied by menus are determined with
+C<set_menus_node_directions>.  The node tree is analysed with C<nodes_tree>.
+Floats get their standard numbering with C<number_floats> and internal
+references are matched up with nodes, floats or anchors with
+C<associate_internal_references>.
 
 It is also possible to group the top-level contents of the tree, which consist
 in nodes and sectioning commands into elements that group together a node and
@@ -1757,12 +1825,9 @@ account C<@part> elements.
 
 =back
 
-=item my $top_node = nodes_tree($parser)
-
-Goes through menu and nodes and set directions.  Returns the top
-node.
+=item set_menus_node_directions($parser)
 
-This functions sets:
+Goes through menu and set directions.
 
 =over
 
@@ -1780,6 +1845,19 @@ Up, next and previous directions as set in menus.
 
 =item node_up
 
+=back
+
+=item my $top_node = nodes_tree($parser)
+
+Goes through nodes and set directions.  Returns the top
+node.
+
+This functions sets:
+
+=over
+
+=item node_up
+
 =item node_prev
 
 =item node_next
diff --git a/tp/t/results/moreindices/index_split.pl 
b/tp/t/results/moreindices/index_split.pl
index 7035d84..cf89f7c 100644
--- a/tp/t/results/moreindices/index_split.pl
+++ b/tp/t/results/moreindices/index_split.pl
@@ -3988,12 +3988,182 @@ $result_nodes{'index_split'} = {
       }
     }
   ],
-  'node_next' => {},
-  'node_prev' => {}
+  'node_next' => {
+    'cmdname' => 'node',
+    'extra' => {
+      'associated_section' => {
+        'cmdname' => 'chapter',
+        'extra' => {
+          'spaces_before_argument' => ' '
+        },
+        'level' => 1,
+        'number' => 1
+      },
+      'isindex' => 1,
+      'normalized' => 'first',
+      'spaces_before_argument' => ' '
+    },
+    'menu_child' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'section',
+          'extra' => {
+            'spaces_before_argument' => ' '
+          },
+          'level' => 2,
+          'number' => '1.1'
+        },
+        'isindex' => 1,
+        'normalized' => 'section-1',
+        'spaces_before_argument' => ' '
+      },
+      'menu_child' => {
+        'cmdname' => 'node',
+        'extra' => {
+          'associated_section' => {
+            'cmdname' => 'subsection',
+            'extra' => {
+              'spaces_before_argument' => ' '
+            },
+            'level' => 3,
+            'number' => '1.1.1'
+          },
+          'normalized' => 'subsection-1',
+          'spaces_before_argument' => ' '
+        },
+        'node_next' => {
+          'cmdname' => 'node',
+          'extra' => {
+            'associated_section' => {
+              'cmdname' => 'subsection',
+              'extra' => {
+                'spaces_before_argument' => ' '
+              },
+              'level' => 3,
+              'number' => '1.1.2'
+            },
+            'isindex' => 1,
+            'normalized' => 'subsection-2',
+            'spaces_before_argument' => ' '
+          },
+          'node_prev' => {},
+          'node_up' => {}
+        },
+        'node_up' => {}
+      },
+      'menus' => [
+        {
+          'cmdname' => 'menu',
+          'extra' => {
+            'end_command' => {
+              'cmdname' => 'end',
+              'extra' => {
+                'command_argument' => 'menu',
+                'spaces_before_argument' => ' ',
+                'text_arg' => 'menu'
+              }
+            }
+          }
+        }
+      ],
+      'node_next' => {
+        'cmdname' => 'node',
+        'extra' => {
+          'associated_section' => {
+            'cmdname' => 'section',
+            'extra' => {
+              'spaces_before_argument' => ' '
+            },
+            'level' => 2,
+            'number' => '1.2'
+          },
+          'normalized' => 'section-2',
+          'spaces_before_argument' => ' '
+        },
+        'node_next' => {
+          'cmdname' => 'node',
+          'extra' => {
+            'associated_section' => {
+              'cmdname' => 'section',
+              'extra' => {
+                'spaces_before_argument' => ' '
+              },
+              'level' => 2,
+              'number' => '1.3'
+            },
+            'isindex' => 1,
+            'normalized' => 'section-3',
+            'spaces_before_argument' => ' '
+          },
+          'node_next' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'node-in-section-3',
+              'spaces_before_argument' => ' '
+            },
+            'node_prev' => {},
+            'node_up' => {}
+          },
+          'node_prev' => {},
+          'node_up' => {}
+        },
+        'node_prev' => {},
+        'node_up' => {}
+      },
+      'node_up' => {}
+    },
+    'menus' => [
+      {
+        'cmdname' => 'menu',
+        'extra' => {
+          'end_command' => {
+            'cmdname' => 'end',
+            'extra' => {
+              'command_argument' => 'menu',
+              'spaces_before_argument' => ' ',
+              'text_arg' => 'menu'
+            }
+          }
+        }
+      }
+    ],
+    'node_next' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'chapter',
+          'extra' => {
+            'spaces_before_argument' => ' '
+          },
+          'level' => 1,
+          'number' => 2
+        },
+        'normalized' => 'second-chapter',
+        'spaces_before_argument' => ' '
+      },
+      'node_prev' => {},
+      'node_up' => {}
+    },
+    'node_prev' => {},
+    'node_up' => {}
+  }
 };
 $result_nodes{'index_split'}{'menu_child'} = $result_nodes{'index_split'};
-$result_nodes{'index_split'}{'node_next'} = $result_nodes{'index_split'};
-$result_nodes{'index_split'}{'node_prev'} = $result_nodes{'index_split'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'menu_child'}{'node_next'}{'node_prev'}
 = $result_nodes{'index_split'}{'node_next'}{'menu_child'}{'menu_child'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'menu_child'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split'}{'node_next'}{'menu_child'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'menu_child'}{'node_up'}
 = $result_nodes{'index_split'}{'node_next'}{'menu_child'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_next'}{'node_prev'}
 = 
$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split'}{'node_next'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_prev'}
 = $result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split'}{'node_next'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'}{'node_prev'}
 = $result_nodes{'index_split'}{'node_next'}{'menu_child'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split'}{'node_next'};
+$result_nodes{'index_split'}{'node_next'}{'menu_child'}{'node_up'} = 
$result_nodes{'index_split'}{'node_next'};
+$result_nodes{'index_split'}{'node_next'}{'node_next'}{'node_prev'} = 
$result_nodes{'index_split'}{'node_next'};
+$result_nodes{'index_split'}{'node_next'}{'node_next'}{'node_up'} = 
$result_nodes{'index_split'};
+$result_nodes{'index_split'}{'node_next'}{'node_prev'} = 
$result_nodes{'index_split'};
+$result_nodes{'index_split'}{'node_next'}{'node_up'} = 
$result_nodes{'index_split'};
 
 $result_menus{'index_split'} = {
   'cmdname' => 'node',
@@ -4154,15 +4324,6 @@ $result_menus{'index_split'}{'menu_up'} = 
$result_menus{'index_split'};
 
 $result_errors{'index_split'} = [
   {
-    'error_line' => 'index_split.texi:23: warning: node `Top\' is prev for 
`first\' in menu but not in sectioning
-',
-    'file_name' => 'index_split.texi',
-    'line_nr' => 23,
-    'macro' => '',
-    'text' => 'node `Top\' is prev for `first\' in menu but not in sectioning',
-    'type' => 'warning'
-  },
-  {
     'error_line' => 'index_split.texi:87: warning: node `node in section 3\' 
is next for `section 3\' in menu but not in sectioning
 ',
     'file_name' => 'index_split.texi',
diff --git a/tp/t/results/moreindices/index_split_nodes.pl 
b/tp/t/results/moreindices/index_split_nodes.pl
index 6b51257..5561774 100644
--- a/tp/t/results/moreindices/index_split_nodes.pl
+++ b/tp/t/results/moreindices/index_split_nodes.pl
@@ -3988,12 +3988,182 @@ $result_nodes{'index_split_nodes'} = {
       }
     }
   ],
-  'node_next' => {},
-  'node_prev' => {}
+  'node_next' => {
+    'cmdname' => 'node',
+    'extra' => {
+      'associated_section' => {
+        'cmdname' => 'chapter',
+        'extra' => {
+          'spaces_before_argument' => ' '
+        },
+        'level' => 1,
+        'number' => 1
+      },
+      'isindex' => 1,
+      'normalized' => 'first',
+      'spaces_before_argument' => ' '
+    },
+    'menu_child' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'section',
+          'extra' => {
+            'spaces_before_argument' => ' '
+          },
+          'level' => 2,
+          'number' => '1.1'
+        },
+        'isindex' => 1,
+        'normalized' => 'section-1',
+        'spaces_before_argument' => ' '
+      },
+      'menu_child' => {
+        'cmdname' => 'node',
+        'extra' => {
+          'associated_section' => {
+            'cmdname' => 'subsection',
+            'extra' => {
+              'spaces_before_argument' => ' '
+            },
+            'level' => 3,
+            'number' => '1.1.1'
+          },
+          'normalized' => 'subsection-1',
+          'spaces_before_argument' => ' '
+        },
+        'node_next' => {
+          'cmdname' => 'node',
+          'extra' => {
+            'associated_section' => {
+              'cmdname' => 'subsection',
+              'extra' => {
+                'spaces_before_argument' => ' '
+              },
+              'level' => 3,
+              'number' => '1.1.2'
+            },
+            'isindex' => 1,
+            'normalized' => 'subsection-2',
+            'spaces_before_argument' => ' '
+          },
+          'node_prev' => {},
+          'node_up' => {}
+        },
+        'node_up' => {}
+      },
+      'menus' => [
+        {
+          'cmdname' => 'menu',
+          'extra' => {
+            'end_command' => {
+              'cmdname' => 'end',
+              'extra' => {
+                'command_argument' => 'menu',
+                'spaces_before_argument' => ' ',
+                'text_arg' => 'menu'
+              }
+            }
+          }
+        }
+      ],
+      'node_next' => {
+        'cmdname' => 'node',
+        'extra' => {
+          'associated_section' => {
+            'cmdname' => 'section',
+            'extra' => {
+              'spaces_before_argument' => ' '
+            },
+            'level' => 2,
+            'number' => '1.2'
+          },
+          'normalized' => 'section-2',
+          'spaces_before_argument' => ' '
+        },
+        'node_next' => {
+          'cmdname' => 'node',
+          'extra' => {
+            'associated_section' => {
+              'cmdname' => 'section',
+              'extra' => {
+                'spaces_before_argument' => ' '
+              },
+              'level' => 2,
+              'number' => '1.3'
+            },
+            'isindex' => 1,
+            'normalized' => 'section-3',
+            'spaces_before_argument' => ' '
+          },
+          'node_next' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'node-in-section-3',
+              'spaces_before_argument' => ' '
+            },
+            'node_prev' => {},
+            'node_up' => {}
+          },
+          'node_prev' => {},
+          'node_up' => {}
+        },
+        'node_prev' => {},
+        'node_up' => {}
+      },
+      'node_up' => {}
+    },
+    'menus' => [
+      {
+        'cmdname' => 'menu',
+        'extra' => {
+          'end_command' => {
+            'cmdname' => 'end',
+            'extra' => {
+              'command_argument' => 'menu',
+              'spaces_before_argument' => ' ',
+              'text_arg' => 'menu'
+            }
+          }
+        }
+      }
+    ],
+    'node_next' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'chapter',
+          'extra' => {
+            'spaces_before_argument' => ' '
+          },
+          'level' => 1,
+          'number' => 2
+        },
+        'normalized' => 'second-chapter',
+        'spaces_before_argument' => ' '
+      },
+      'node_prev' => {},
+      'node_up' => {}
+    },
+    'node_prev' => {},
+    'node_up' => {}
+  }
 };
 $result_nodes{'index_split_nodes'}{'menu_child'} = 
$result_nodes{'index_split_nodes'};
-$result_nodes{'index_split_nodes'}{'node_next'} = 
$result_nodes{'index_split_nodes'};
-$result_nodes{'index_split_nodes'}{'node_prev'} = 
$result_nodes{'index_split_nodes'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'menu_child'}{'node_next'}{'node_prev'}
 = $result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'menu_child'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'menu_child'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'menu_child'}{'node_up'}
 = $result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_next'}{'node_prev'}
 = 
$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split_nodes'}{'node_next'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_prev'}
 = $result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split_nodes'}{'node_next'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'}{'node_prev'}
 = $result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_next'}{'node_up'}
 = $result_nodes{'index_split_nodes'}{'node_next'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'menu_child'}{'node_up'} = 
$result_nodes{'index_split_nodes'}{'node_next'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'node_next'}{'node_prev'} = 
$result_nodes{'index_split_nodes'}{'node_next'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'node_next'}{'node_up'} = 
$result_nodes{'index_split_nodes'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'node_prev'} = 
$result_nodes{'index_split_nodes'};
+$result_nodes{'index_split_nodes'}{'node_next'}{'node_up'} = 
$result_nodes{'index_split_nodes'};
 
 $result_menus{'index_split_nodes'} = {
   'cmdname' => 'node',
diff --git a/tp/t/results/sectioning/section_chapter_before_top_nodes.pl 
b/tp/t/results/sectioning/section_chapter_before_top_nodes.pl
index 186d560..7b2434d 100644
--- a/tp/t/results/sectioning/section_chapter_before_top_nodes.pl
+++ b/tp/t/results/sectioning/section_chapter_before_top_nodes.pl
@@ -730,7 +730,7 @@ $result_nodes{'section_chapter_before_top_nodes'} = {
 
$result_nodes{'section_chapter_before_top_nodes'}{'menu_child'}{'menu_child'}{'node_next'}
 = $result_nodes{'section_chapter_before_top_nodes'}{'menu_child'};
 
$result_nodes{'section_chapter_before_top_nodes'}{'menu_child'}{'menu_child'}{'node_up'}
 = $result_nodes{'section_chapter_before_top_nodes'}{'menu_child'};
 $result_nodes{'section_chapter_before_top_nodes'}{'menu_child'}{'node_next'} = 
$result_nodes{'section_chapter_before_top_nodes'};
-$result_nodes{'section_chapter_before_top_nodes'}{'menu_child'}{'node_prev'} = 
$result_nodes{'section_chapter_before_top_nodes'};
+$result_nodes{'section_chapter_before_top_nodes'}{'menu_child'}{'node_prev'} = 
$result_nodes{'section_chapter_before_top_nodes'}{'menu_child'}{'menu_child'};
 $result_nodes{'section_chapter_before_top_nodes'}{'menu_child'}{'node_up'} = 
$result_nodes{'section_chapter_before_top_nodes'};
 $result_nodes{'section_chapter_before_top_nodes'}{'node_next'} = 
$result_nodes{'section_chapter_before_top_nodes'}{'menu_child'};
 
@@ -819,7 +819,7 @@ File: ,  Node: section node,  Next: chapter node,  Up: 
chapter node
 =========
 
 
-File: ,  Node: chapter node,  Next: Top,  Prev: Top,  Up: Top
+File: ,  Node: chapter node,  Next: Top,  Prev: section node,  Up: Top
 
 2 chapter
 =========
@@ -843,7 +843,7 @@ top
 Tag Table:
 Node: section node27
 Node: chapter node119
-Node: Top232
+Node: Top241
 
 End Tag Table
 
@@ -904,7 +904,7 @@ Next: <a href="#chapter-node" accesskey="n" 
rel="next">chapter</a>, Up: <a href=
 <div class="chapter" id="chapter-node">
 <div class="header">
 <p>
-Next: <a href="#Top" accesskey="n" rel="next">top</a>, Previous: <a 
href="#Top" accesskey="p" rel="prev">top</a>, Up: <a href="#Top" accesskey="u" 
rel="up">top</a> &nbsp; </p>
+Next: <a href="#Top" accesskey="n" rel="next">top</a>, Previous: <a 
href="#section-node" accesskey="p" rel="prev">section</a>, Up: <a href="#Top" 
accesskey="u" rel="up">top</a> &nbsp; </p>
 </div>
 <span id="chapter"></span><h3 class="section">2 chapter</h3>
 
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 67ee3ad..399cc2c 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -786,6 +786,7 @@ sub test($$)
 
   Texinfo::Structuring::number_floats($floats);
 
+  Texinfo::Structuring::set_menus_node_directions($parser);
   my $top_node = Texinfo::Structuring::nodes_tree($parser);
 
   my ($errors, $error_nrs) = $parser->errors();
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index ceacec4..5871900 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1258,6 +1258,7 @@ while(@input_files) {
 
   my $top_node;
   if ($formats_table{$format}->{'nodes_tree'}) {
+    Texinfo::Structuring::set_menus_node_directions($parser);
     $top_node = Texinfo::Structuring::nodes_tree($parser);
   }
   if ($formats_table{$format}->{'floats'}) {



reply via email to

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