texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Convert/XML.pm t/xml_tests.t...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/XML.pm t/xml_tests.t...
Date: Sat, 17 Sep 2011 20:42:10 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/17 20:42:10

Modified files:
        tp/Texinfo/Convert: XML.pm 
        tp/t           : xml_tests.t 
Added files:
        tp/t/results/xml_tests: node_no_section.pl 

Log message:
        Fix document with no section handling.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/xml_tests.t?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/xml_tests/node_no_section.pl?cvsroot=texinfo&rev=1.1

Patches:
Index: Texinfo/Convert/XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- Texinfo/Convert/XML.pm      17 Sep 2011 20:28:19 -0000      1.35
+++ Texinfo/Convert/XML.pm      17 Sep 2011 20:42:10 -0000      1.36
@@ -965,7 +965,8 @@
   # The command is closed either when the corresponding tree element
   # is done, and the command is not associated to an element, or when
   # the element is closed.
-  } elsif (($root->{'type'} and $root->{'type'} eq 'element')
+  } elsif (($root->{'type'} and $root->{'type'} eq 'element'
+            and $root->{'extra'} and $root->{'extra'}->{'element_command'})
            or ($root->{'cmdname'} 
                and $Texinfo::Common::root_commands{$root->{'cmdname'}}
                and $root->{'cmdname'} ne 'node'

Index: t/xml_tests.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/xml_tests.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- t/xml_tests.t       14 Sep 2011 22:59:13 -0000      1.3
+++ t/xml_tests.t       17 Sep 2011 20:42:10 -0000      1.4
@@ -130,6 +130,9 @@
 <in>
 @end xml
 '],
+['node_no_section',
+'@node Top
+'],
 );
 
 foreach my $test (@test_cases) {

Index: t/results/xml_tests/node_no_section.pl
===================================================================
RCS file: t/results/xml_tests/node_no_section.pl
diff -N t/results/xml_tests/node_no_section.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/xml_tests/node_no_section.pl      17 Sep 2011 20:42:10 -0000      
1.1
@@ -0,0 +1,117 @@
+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_elements %result_directions_text);
+
+use utf8;
+
+$result_trees{'node_no_section'} = {
+  'contents' => [
+    {
+      'contents' => [],
+      'parent' => {},
+      'type' => 'text_root'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'extra' => {
+                'command' => {}
+              },
+              'parent' => {},
+              'text' => ' ',
+              'type' => 'empty_spaces_after_command'
+            },
+            {
+              'parent' => {},
+              'text' => 'Top'
+            },
+            {
+              'parent' => {},
+              'text' => '
+',
+              'type' => 'spaces_at_end'
+            }
+          ],
+          'parent' => {},
+          'type' => 'misc_line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'contents' => [],
+      'extra' => {
+        'node_content' => [
+          {}
+        ],
+        'nodes_manuals' => [
+          {
+            'node_content' => [],
+            'normalized' => 'Top'
+          }
+        ],
+        'normalized' => 'Top'
+      },
+      'line_nr' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      },
+      'parent' => {}
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'node_no_section'}{'contents'}[0]{'parent'} = 
$result_trees{'node_no_section'};
+$result_trees{'node_no_section'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
 = $result_trees{'node_no_section'}{'contents'}[1];
+$result_trees{'node_no_section'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'node_no_section'}{'contents'}[1]{'args'}[0];
+$result_trees{'node_no_section'}{'contents'}[1]{'args'}[0]{'contents'}[1]{'parent'}
 = $result_trees{'node_no_section'}{'contents'}[1]{'args'}[0];
+$result_trees{'node_no_section'}{'contents'}[1]{'args'}[0]{'contents'}[2]{'parent'}
 = $result_trees{'node_no_section'}{'contents'}[1]{'args'}[0];
+$result_trees{'node_no_section'}{'contents'}[1]{'args'}[0]{'parent'} = 
$result_trees{'node_no_section'}{'contents'}[1];
+$result_trees{'node_no_section'}{'contents'}[1]{'extra'}{'node_content'}[0] = 
$result_trees{'node_no_section'}{'contents'}[1]{'args'}[0]{'contents'}[1];
+$result_trees{'node_no_section'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}
 = $result_trees{'node_no_section'}{'contents'}[1]{'extra'}{'node_content'};
+$result_trees{'node_no_section'}{'contents'}[1]{'parent'} = 
$result_trees{'node_no_section'};
+
+$result_texis{'node_no_section'} = '@node Top
+';
+
+
+$result_texts{'node_no_section'} = '';
+
+$result_sectioning{'node_no_section'} = {};
+
+$result_nodes{'node_no_section'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'Top'
+  },
+  'node_up' => {
+    'extra' => {
+      'manual_content' => [
+        {
+          'text' => 'dir'
+        }
+      ],
+      'top_node_up' => {}
+    },
+    'type' => 'top_node_up'
+  }
+};
+$result_nodes{'node_no_section'}{'node_up'}{'extra'}{'top_node_up'} = 
$result_nodes{'node_no_section'};
+
+$result_menus{'node_no_section'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'Top'
+  }
+};
+
+$result_errors{'node_no_section'} = [];
+
+
+
+$result_converted{'xml'}->{'node_no_section'} = '<node 
name="Top"><nodename>Top</nodename><nodeup automatic="on">(dir)</nodeup></node>
+';
+
+1;



reply via email to

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