texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Structuring.pm Texinfo/Conve...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Structuring.pm Texinfo/Conve...
Date: Sun, 20 Feb 2011 00:18:16 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/02/20 00:18:16

Modified files:
        tp/Texinfo     : Structuring.pm 
        tp/Texinfo/Convert: Info.pm 
        tp/t           : info_tests.t 
Added files:
        tp/t/results/info_tests: no_node_but_top.pl 

Log message:
        Handle the case of node top in menu.
        There are no node when there are only sectioning elements.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/info_tests.t?cvsroot=texinfo&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/info_tests/no_node_but_top.pl?cvsroot=texinfo&rev=1.1

Patches:
Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- Texinfo/Structuring.pm      19 Feb 2011 13:12:34 -0000      1.31
+++ Texinfo/Structuring.pm      20 Feb 2011 00:18:15 -0000      1.32
@@ -449,7 +449,15 @@
         }
       }
     }
+    # A bit of explanation about 
!$node->{'node_up'}->{'extra'}->{'normalized'}:
+    # it may happen (rarely) that the node_up has only a manual entry
+    # and therefore !$node->{'node_up'}->{'extra'}->{'normalized'}
+    # In that case there is always a {'manual_content'} and the condition 
+    # !$node->{'node_up'}->{'extra'}->{'manual_content'} is never set.
+    # The node_up should always be different from the menu_up, therefore
+    # if in a menu, the second condition/error message applies.
     if ($node->{'node_up'} and (!$node->{'menu_up_hash'}
+         or !$node->{'node_up'}->{'extra'}->{'normalized'}
          or 
!$node->{'menu_up_hash'}->{$node->{'node_up'}->{'extra'}->{'normalized'}})) {
       if (!$node->{'node_up'}->{'extra'}->{'manual_content'}) {
       # up node has no menu entry

Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- Texinfo/Convert/Info.pm     19 Feb 2011 18:04:39 -0000      1.29
+++ Texinfo/Convert/Info.pm     20 Feb 2011 00:18:15 -0000      1.30
@@ -135,7 +135,7 @@
       return undef;
     }
   }
-  if (!defined($elements)) {
+  if (!defined($elements) or $elements->[0]->{'extra'}->{'no_node'}) {
     $self->document_warn($self->__("Document without nodes."));
     my $output = $header.$self->_convert($root);
     my ($footnotes) = $self->_footnotes();

Index: t/info_tests.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/info_tests.t,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- t/info_tests.t      19 Feb 2011 18:04:40 -0000      1.16
+++ t/info_tests.t      20 Feb 2011 00:18:15 -0000      1.17
@@ -274,6 +274,9 @@
 @bye
 
 ',{},{'SPLIT_SIZE' => 10}],
+['no_node_but_top',
+'@top top
+'],
 );
 
 foreach my $test (@test_cases) {

Index: t/results/info_tests/no_node_but_top.pl
===================================================================
RCS file: t/results/info_tests/no_node_but_top.pl
diff -N t/results/info_tests/no_node_but_top.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/info_tests/no_node_but_top.pl     20 Feb 2011 00:18:16 -0000      
1.1
@@ -0,0 +1,104 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors);
+
+$result_trees{'no_node_but_top'} = {
+  'contents' => [
+    {
+      'contents' => [],
+      'parent' => {},
+      'type' => 'text_root'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'parent' => {},
+              'text' => ' ',
+              'type' => 'empty_spaces_after_command'
+            },
+            {
+              'parent' => {},
+              'text' => 'top'
+            },
+            {
+              'parent' => {},
+              'text' => '
+',
+              'type' => 'spaces_at_end'
+            }
+          ],
+          'parent' => {},
+          'type' => 'misc_line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'contents' => [],
+      'extra' => {
+        'misc_content' => [
+          {}
+        ]
+      },
+      'level' => 0,
+      'line_nr' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      },
+      'parent' => {}
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'no_node_but_top'}{'contents'}[0]{'parent'} = 
$result_trees{'no_node_but_top'};
+$result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0];
+$result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0]{'contents'}[1]{'parent'}
 = $result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0];
+$result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0]{'contents'}[2]{'parent'}
 = $result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0];
+$result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0]{'parent'} = 
$result_trees{'no_node_but_top'}{'contents'}[1];
+$result_trees{'no_node_but_top'}{'contents'}[1]{'extra'}{'misc_content'}[0] = 
$result_trees{'no_node_but_top'}{'contents'}[1]{'args'}[0]{'contents'}[1];
+$result_trees{'no_node_but_top'}{'contents'}[1]{'parent'} = 
$result_trees{'no_node_but_top'};
+
+$result_texis{'no_node_but_top'} = '@top top
+';
+
+
+$result_texts{'no_node_but_top'} = 'top
+***
+';
+
+$result_sectioning{'no_node_but_top'} = {
+  'level' => -1,
+  'section_childs' => [
+    {
+      'cmdname' => 'top',
+      'extra' => {},
+      'level' => 0,
+      'section_up' => {}
+    }
+  ]
+};
+$result_sectioning{'no_node_but_top'}{'section_childs'}[0]{'section_up'} = 
$result_sectioning{'no_node_but_top'};
+
+$result_errors{'no_node_but_top'} = [];
+
+
+
+$result_converted{'info'}->{'no_node_but_top'} = 'This is , produced by 
makeinfo version 4.13 from .
+
+top
+***
+
+';
+
+$result_converted_errors{'info'}->{'no_node_but_top'} = [
+  {
+    'error_line' => 'warning: Document without nodes.
+',
+    'text' => 'Document without nodes.',
+    'type' => 'warning'
+  }
+];
+
+
+1;



reply via email to

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