texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Structuring.pm t/30sectionin...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Structuring.pm t/30sectionin...
Date: Sun, 03 Jul 2011 14:45:34 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/07/03 14:45:34

Modified files:
        tp/Texinfo     : Structuring.pm 
        tp/t           : 30sectioning.t test_utils.pl 
        tp/t/results/sectioning: part_before_section.pl 

Log message:
        Associate @part to the following element.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/30sectioning.t?cvsroot=texinfo&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/sectioning/part_before_section.pl?cvsroot=texinfo&r1=1.5&r2=1.6

Patches:
Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- Texinfo/Structuring.pm      30 Jun 2011 23:42:37 -0000      1.64
+++ Texinfo/Structuring.pm      3 Jul 2011 14:45:33 -0000       1.65
@@ -506,7 +506,13 @@
   my $elements;
   my $current = { 'type' => 'element', 'extra' => {'no_node' => 1}};
   push @$elements, $current; 
+  my @pending_parts = ();
   foreach my $content (@{$root->{'contents'}}) {
+    if ($content->{'cmdname'} and $content->{'cmdname'} eq 'part'
+        and $content->{'extra'}->{'part_associated_section'}) {
+      push @pending_parts, $content;
+      next;
+    }
     if ($content->{'cmdname'} and $content->{'cmdname'} eq 'node') {
       if ($current->{'extra'}->{'no_node'}) {
         delete $current->{'extra'}->{'no_node'};
@@ -523,6 +529,13 @@
           = $content->{'extra'}->{'associated_section'};
       }
     }
+    if (@pending_parts) {
+      foreach my $part (@pending_parts) {
+        push @{$current->{'contents'}}, $part;
+        $part->{'parent'} = $current;
+      }
+      @pending_parts = ();
+    }
     push @{$current->{'contents'}}, $content;
     $content->{'parent'} = $current;
   }
@@ -537,9 +550,15 @@
     return undef;
   }
   my $elements;
+  my @pending_parts = ();
   my $current = { 'type' => 'element', 'extra' => {'no_section' => 1}};
   push @$elements, $current; 
   foreach my $content (@{$root->{'contents'}}) {
+    if ($content->{'cmdname'} and $content->{'cmdname'} eq 'part'
+        and $content->{'extra'}->{'part_associated_section'}) {
+      push @pending_parts, $content;
+      next;
+    }
     if ($content->{'cmdname'} and $content->{'cmdname'} eq 'node' 
          and $content->{'extra'}->{'associated_section'}) {
       if ($current->{'extra'}->{'no_section'}) {
@@ -572,6 +591,13 @@
         push @$elements, $current;
       }
     }
+    if (@pending_parts) {
+      foreach my $part (@pending_parts) {
+        push @{$current->{'contents'}}, $part;
+        $part->{'parent'} = $current;
+      }
+      @pending_parts = ();
+    }
     push @{$current->{'contents'}}, $content;
     $content->{'parent'} = $current;
   }

Index: t/30sectioning.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/30sectioning.t,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- t/30sectioning.t    3 Jul 2011 11:11:58 -0000       1.38
+++ t/30sectioning.t    3 Jul 2011 14:45:34 -0000       1.39
@@ -283,7 +283,8 @@
 @node node chapter
 @chapter chapter after 2 parts
 
-'],
+', #{'test_split' => 'section', 'test_split_pages' => 'chapter'}
+],
 ['setfilename_on_top_and_after_node',
 '@node Top
 @top In top @setfilename very badly placed setfilename
@@ -1233,7 +1234,7 @@
 @node second node
 @chapter a chapter
 '],
-['part_before_section',
+['part_before_section', # FIXME do HTML
 '@part part
 
 @section section 

Index: t/test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- t/test_utils.pl     3 Jul 2011 11:11:58 -0000       1.80
+++ t/test_utils.pl     3 Jul 2011 14:45:34 -0000       1.81
@@ -24,9 +24,10 @@
 #use Struct::Compare;
 use Getopt::Long qw(GetOptions);
 
+# FIXME Is it really useful?
 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_floats %result_converted %result_converted_errors %result_elements);
 
 my $strings_textdomain = 'texi2html_document';
 Locale::Messages->select_package ('gettext_pp');
@@ -359,6 +360,7 @@
       #print STDERR "$format: \n$converted{$format}";
     }
   }
+  my $directions_text;
   # re-associate elements with the document_root.
   Texinfo::Structuring::_unsplit($result);
   my $elements;
@@ -369,6 +371,10 @@
   }
   if ($split) {
     Texinfo::Structuring::elements_directions($parser, $elements);
+    $directions_text = '';
+    foreach my $element (@$elements) {
+      $directions_text .= Texinfo::Structuring::_print_directions($element);
+    }
   }
   my $pages;
   if ($split_pages) {

Index: t/results/sectioning/part_before_section.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/sectioning/part_before_section.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- t/results/sectioning/part_before_section.pl 3 Jul 2011 11:11:58 -0000       
1.5
+++ t/results/sectioning/part_before_section.pl 3 Jul 2011 14:45:34 -0000       
1.6
@@ -61,16 +61,7 @@
           'macro' => ''
         },
         'parent' => {}
-      }
-    ],
-    'extra' => {
-      'element_command' => {},
-      'section' => {}
     },
-    'type' => 'element'
-  },
-  {
-    'contents' => [
       {
         'args' => [
           {
@@ -116,7 +107,6 @@
         'parent' => {}
       }
     ],
-    'element_prev' => {},
     'extra' => {
       'element_command' => {},
       'section' => {}
@@ -133,19 +123,16 @@
 
$result_trees{'part_before_section'}[0]{'contents'}[1]{'contents'}[0]{'parent'} 
= $result_trees{'part_before_section'}[0]{'contents'}[1];
 
$result_trees{'part_before_section'}[0]{'contents'}[1]{'extra'}{'misc_content'}[0]
 = 
$result_trees{'part_before_section'}[0]{'contents'}[1]{'args'}[0]{'contents'}[1];
 $result_trees{'part_before_section'}[0]{'contents'}[1]{'parent'} = 
$result_trees{'part_before_section'}[0];
-$result_trees{'part_before_section'}[0]{'extra'}{'element_command'} = 
$result_trees{'part_before_section'}[0]{'contents'}[1];
-$result_trees{'part_before_section'}[0]{'extra'}{'section'} = 
$result_trees{'part_before_section'}[0]{'contents'}[1];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
 = $result_trees{'part_before_section'}[1]{'contents'}[0];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0]{'contents'}[1]{'parent'}
 = $result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0]{'contents'}[2]{'parent'}
 = $result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0]{'parent'} = 
$result_trees{'part_before_section'}[1]{'contents'}[0];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'extra'}{'associated_part'}
 = $result_trees{'part_before_section'}[0]{'contents'}[1];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'extra'}{'misc_content'}[0]
 = 
$result_trees{'part_before_section'}[1]{'contents'}[0]{'args'}[0]{'contents'}[1];
-$result_trees{'part_before_section'}[1]{'contents'}[0]{'parent'} = 
$result_trees{'part_before_section'}[1];
-$result_trees{'part_before_section'}[1]{'element_prev'} = 
$result_trees{'part_before_section'}[0];
-$result_trees{'part_before_section'}[1]{'extra'}{'element_command'} = 
$result_trees{'part_before_section'}[1]{'contents'}[0];
-$result_trees{'part_before_section'}[1]{'extra'}{'section'} = 
$result_trees{'part_before_section'}[1]{'contents'}[0];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
 = $result_trees{'part_before_section'}[0]{'contents'}[2];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0]{'contents'}[1]{'parent'}
 = $result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0]{'contents'}[2]{'parent'}
 = $result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0]{'parent'} = 
$result_trees{'part_before_section'}[0]{'contents'}[2];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'extra'}{'associated_part'}
 = $result_trees{'part_before_section'}[0]{'contents'}[1];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'extra'}{'misc_content'}[0]
 = 
$result_trees{'part_before_section'}[0]{'contents'}[2]{'args'}[0]{'contents'}[1];
+$result_trees{'part_before_section'}[0]{'contents'}[2]{'parent'} = 
$result_trees{'part_before_section'}[0];
+$result_trees{'part_before_section'}[0]{'extra'}{'element_command'} = 
$result_trees{'part_before_section'}[0]{'contents'}[2];
+$result_trees{'part_before_section'}[0]{'extra'}{'section'} = 
$result_trees{'part_before_section'}[0]{'contents'}[2];
 
 $result_texis{'part_before_section'} = '@part part
 
@@ -206,11 +193,6 @@
   {
     'extra' => {
       'directions' => {
-        'FastForward' => {
-          'extra' => {
-            'directions' => {
-              'Back' => {},
-              'FastBack' => {},
               'This' => {},
               'Up' => {}
             },
@@ -229,28 +211,11 @@
             'section' => {}
           },
           'type' => 'element'
-        },
-        'Forward' => {},
-        'This' => {},
-        'Up' => undef
-      },
-      'element_command' => {},
-      'section' => {}
-    },
-    'type' => 'element'
-  },
-  {}
+  }
 ];
-$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'directions'}{'Back'}
 = $result_elements{'part_before_section'}[0];
-$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'directions'}{'FastBack'}
 = $result_elements{'part_before_section'}[0];
-$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'directions'}{'This'}
 = 
$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'};
-$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'directions'}{'Up'}
 = $result_elements{'part_before_section'}[0];
-$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'section'}
 = 
$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'element_command'};
-$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'Forward'} = 
$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'};
 $result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'This'} = 
$result_elements{'part_before_section'}[0];
-$result_elements{'part_before_section'}[0]{'extra'}{'element_command'} = 
$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'element_command'}{'extra'}{'associated_part'};
-$result_elements{'part_before_section'}[0]{'extra'}{'section'} = 
$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'}{'extra'}{'element_command'}{'extra'}{'associated_part'};
-$result_elements{'part_before_section'}[1] = 
$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'FastForward'};
+$result_elements{'part_before_section'}[0]{'extra'}{'directions'}{'Up'} = 
$result_elements{'part_before_section'}[0];
+$result_elements{'part_before_section'}[0]{'extra'}{'section'} = 
$result_elements{'part_before_section'}[0]{'extra'}{'element_command'};
 
 
 1;



reply via email to

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