texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo Structuring.pm


From: Patrice Dumas
Subject: texinfo/tp/Texinfo Structuring.pm
Date: Sat, 04 Jun 2011 21:49:04 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/06/04 21:49:04

Modified files:
        tp/Texinfo     : Structuring.pm 

Log message:
        Find FastBack and FastForward for elements without section too.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.60&r2=1.61

Patches:
Index: Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- Structuring.pm      4 Jun 2011 08:11:37 -0000       1.60
+++ Structuring.pm      4 Jun 2011 21:49:04 -0000       1.61
@@ -727,7 +727,33 @@
             and $directions->{'NodeForward'}->{'type'} eq 'element'
             and 
!$directions->{'NodeForward'}->{'extra'}->{'directions'}->{'NodeBack'});
     }
-    if ($element->{'extra'}->{'section'}) {
+
+    if (!$element->{'extra'}->{'section'}) {
+      # If there is no associated section, find the previous element section.
+      # Use the FastForward of this element.
+      # Use it as FastBack if the section is top level, or use the FastBack.
+      my $section_element;
+      my $current = $element;
+      while ($current->{'element_prev'}) {
+        $current = $current->{'element_prev'};
+        if ($current->{'extra'}->{'section'}) {
+          $section_element = $current;
+          last;
+        }
+      }
+      if ($section_element) {
+        if ($section_element->{'extra'}->{'directions'}->{'FastForward'}) {
+          $directions->{'FastForward'} 
+            = $section_element->{'extra'}->{'directions'}->{'FastForward'};
+        }
+        if ($section_element->{'extra'}->{'section'}->{'level'} <= 1) {
+          $directions->{'FastBack'} = $section_element;
+        } elsif ($section_element->{'extra'}->{'directions'}->{'Fastback'}) {
+          $directions->{'FastBack'} 
+            = $section_element->{'extra'}->{'directions'}->{'Fastback'};
+        }
+      }
+    } else {
       my $section = $element->{'extra'}->{'section'};
       foreach my $direction(['Up', 'section_up'], ['Next', 'section_next'],
                             ['Prev', 'section_prev']) {
@@ -761,7 +787,7 @@
           = $element if ($directions->{'FastForward'});
       }
     }
-    # Use node up if there is no section up.
+    # Use node up for Up if there is no section up.
     # FIXME is it really right?
     if (!$directions->{'Up'} and $element->{'extra'}->{'node'}
         and $element->{'extra'}->{'node'}->{'node_up'} 



reply via email to

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