texinfo-commits
[Top][All Lists]
Advanced

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

[7460] _check_menu_entry


From: gavinsmith0123
Subject: [7460] _check_menu_entry
Date: Mon, 17 Oct 2016 20:45:24 +0000 (UTC)

Revision: 7460
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7460
Author:   gavin
Date:     2016-10-17 20:45:24 +0000 (Mon, 17 Oct 2016)
Log Message:
-----------
_check_menu_entry

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Structuring.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-10-17 18:56:40 UTC (rev 7459)
+++ trunk/ChangeLog     2016-10-17 20:45:24 UTC (rev 7460)
@@ -1,3 +1,10 @@
+2016-10-17  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Structuring.pm (_check_menu_entry): Remove 
+       '$check_menu_entries' argument, and don't return anything.  
+       Callers updated.
+       (nodes_tree): Some comments changed.
+
 2016-10-16  Gavin Smith  <address@hidden>
 
        * tp/Texinfo/Parser.pm (_parse_float_type): Convert type of

Modified: trunk/tp/Texinfo/Structuring.pm
===================================================================
--- trunk/tp/Texinfo/Structuring.pm     2016-10-17 18:56:40 UTC (rev 7459)
+++ trunk/tp/Texinfo/Structuring.pm     2016-10-17 20:45:24 UTC (rev 7460)
@@ -536,28 +536,25 @@
  'up' => 'Up'
 );
 
-sub _check_menu_entry($$$$)
+sub _check_menu_entry($$$)
 {
   my $self = shift;
   my $command = shift;
   my $menu_content = shift;
-  my $check_menu_entries = shift;
 
-  my $menu_node;
+  my $normalized_menu_node
+      = $menu_content->{'extra'}->{'menu_entry_node'}->{'normalized'};
 
-  if 
(!$self->{'labels'}->{$menu_content->{'extra'}->{'menu_entry_node'}->{'normalized'}})
 {
-    if ($check_menu_entries) {
-      $self->line_error(sprintf($self->
-       __("address@hidden reference to nonexistent node `%s'"), $command,
-          node_extra_to_texi($menu_content->{'extra'}->{'menu_entry_node'})), 
-       $menu_content->{'line_nr'});
-    }
+  my $menu_node = $self->{'labels'}->{$normalized_menu_node};
+
+  if (!$menu_node) {
+    $self->line_error(sprintf($self->
+     __("address@hidden reference to nonexistent node `%s'"), $command,
+        node_extra_to_texi($menu_content->{'extra'}->{'menu_entry_node'})), 
+     $menu_content->{'line_nr'});
   } else {
-    my $normalized_menu_node
-      = $menu_content->{'extra'}->{'menu_entry_node'}->{'normalized'};
-    $menu_node = $self->{'labels'}->{$normalized_menu_node};
-    if ($check_menu_entries and ! _check_node_same_texinfo_code($menu_node, 
-        $menu_content->{'extra'}->{'menu_entry_node'})) {
+    if (!_check_node_same_texinfo_code($menu_node, 
+                           $menu_content->{'extra'}->{'menu_entry_node'})) {
       $self->line_warn(sprintf($self->
        __("address@hidden entry node name `%s' different from %s name `%s'"), 
          $command,
@@ -567,12 +564,11 @@
                             $menu_content->{'line_nr'});
     }
   }
-  return $menu_node;
 }
 
-# first go through all the menu and set menu_up, menu_next, menu_prev
+# First go through all the menus and set menu_up, menu_next and menu_prev,
 # and warn for unknown nodes.
-# then go through all the nodes and set directions
+# Then go through all the nodes and set directions.
 sub nodes_tree($)
 {
   my $self = shift;
@@ -601,8 +597,9 @@
         }
       }
       # Remark: since the @menu are only checked if they are in @node, 
-      # menu entry before the first node may be treated slightly differently.
-      # at least, there are no error messages for them
+      # menu entries before the first node, or @menu nested inside
+      # another command such as @format, may be treated slightly
+      # differently; at least, there are no error messages for them.
 
       foreach my $menu (@{$node->{'menus'}}) {
         my $previous_node;
@@ -612,8 +609,13 @@
             my $menu_node;
             my $external_node;
             if 
(!$menu_content->{'extra'}->{'menu_entry_node'}->{'manual_content'}) {
-              $menu_node = _check_menu_entry($self, 'menu', $menu_content, 
-                                                    $check_menu_entries);
+              $menu_node = $self->{'labels'}->{
+                      $menu_content->{'extra'}
+                                   ->{'menu_entry_node'}->{'normalized'}};
+
+              if ($check_menu_entries) {
+                _check_menu_entry($self, 'menu', $menu_content);
+              }
               # this may happen more than once for a given node if the node 
               # is in more than one menu.  Therefore all the menu up node 
               # are kept in $menu_node->{'menu_up_hash'}
@@ -643,6 +645,7 @@
       }
     }
   }
+  # Check @detailmenu
   if ($check_menu_entries) {
     my $global_commands = $self->global_commands_information();
     if ($global_commands->{'detailmenu'}) {
@@ -651,8 +654,7 @@
           if ($menu_content->{'extra'}
              and $menu_content->{'extra'}->{'menu_entry_node'}) {
             if 
(!$menu_content->{'extra'}->{'menu_entry_node'}->{'manual_content'}) {
-              _check_menu_entry($self, 'detailmenu', $menu_content, 
-                                $check_menu_entries);
+              _check_menu_entry($self, 'detailmenu', $menu_content);
             }
           }
         }




reply via email to

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