texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo Common.pm Structuring.pm Con...


From: Patrice Dumas
Subject: texinfo/tp/Texinfo Common.pm Structuring.pm Con...
Date: Thu, 21 Apr 2011 22:30:17 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/04/21 22:30:17

Modified files:
        tp/Texinfo     : Common.pm Structuring.pm 
        tp/Texinfo/Convert: HTML.pm 

Log message:
        Fixes for headers.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.29&r2=1.30

Patches:
Index: Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- Common.pm   17 Apr 2011 07:27:57 -0000      1.36
+++ Common.pm   21 Apr 2011 22:30:17 -0000      1.37
@@ -128,6 +128,8 @@
   'TEXI2DVI', 'DUMP_TREE', 'MAX_MACRO_CALL_NESTING',
   'PROGRAM_AND_VERSION', 'PROGRAM_HOMEPAGE', 'PROGRAM',
   'AFTER_BODY_OPEN', 'EXTRA_HEAD', 'LINKS_BUTTONS', 'DO_ABOUT',
+  'TOP_BUTTONS', 'SECTION_BUTTONS', 'NAVIGATION_TEXT',
+  'BUTTONS_ACCESSKEY', 'BUTTONS_REL', 'BUTTONS_GOTO',
   'PRE_BODY_CLOSE', 'DEFAULT_RULE',
   'CSS_FILES', 'CSS_REFS');
 

Index: Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- Structuring.pm      20 Apr 2011 22:21:33 -0000      1.55
+++ Structuring.pm      21 Apr 2011 22:30:17 -0000      1.56
@@ -842,6 +842,25 @@
   }
 }
 
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+# for debugging
+sub _print_root_command_texi($)
+{
+  my $command = shift;
+  my $tree;
+  if ($command->{'cmdname'}) {
+    if ($command->{'cmdname'} eq 'node') {
+      $tree = $command->{'extra'}->{'node_content'};
+    } elsif ($sectioning_commands{$command->{'cmdname'}}) {
+      $tree = $command->{'extra'}->{'misc_content'};
+    }
+  }
+  return '@'.$command->{'cmdname'}. ' '
+       .Texinfo::Convert::Texinfo::convert ({'contents' => $tree})
+          if ($tree);
+  return undef;
+}
+
 sub _print_element_command_texi($)
 {
   my $element = shift;
@@ -862,14 +881,7 @@
     $result .= "(type $element->{'type'})" if (defined($element->{'type'}));
     return $result;
   }
-  my $tree;
-  if ($command->{'cmdname'} eq 'node') {
-    $tree = $command->{'extra'}->{'node_content'};
-  } else {
-    $tree = $command->{'extra'}->{'misc_content'};
-  }
-  return '@'.$command->{'cmdname'}. ' '
-       .Texinfo::Convert::Texinfo::convert ({'contents' => $tree});
+  return _print_root_command_texi($command);
 }
 
 sub _print_directions($)

Index: Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- Convert/HTML.pm     20 Apr 2011 22:21:33 -0000      1.29
+++ Convert/HTML.pm     21 Apr 2011 22:30:17 -0000      1.30
@@ -336,6 +336,14 @@
      'NextFile',    $self->gdt('NextFile'),
      'PrevFile',    $self->gdt('PrevFile'),
   );
+  foreach my $hash (\%NAVIGATION_TEXT, \%BUTTONS_GOTO, \%BUTTONS_NAME) {
+    foreach my $button (keys (%$hash)) {
+      if (ref($hash->{$button})) {
+        # FIXME put it out of document context
+        $hash->{$button} = $self->convert_tree($hash->{$button});
+      }
+    }
+  }
 }
 
 # insert here name of icon images for buttons
@@ -429,8 +437,14 @@
   'TRANSLITERATE_FILE_NAMES' => 1,
   'USE_LINKS'            => 1,
   'DATE_IN_HEADER'       => 0,
+  'HEADERS'              => 1,
   'LINKS_BUTTONS'        => ['Top', 'Index', 'Contents', 'About', 
                               'Up', 'NextFile', 'PrevFile'],
+  'TOP_BUTTONS'          => ['Back', 'Forward', ' ',
+                             'Contents', 'Index', 'About'],
+  'SECTION_BUTTONS'      => ['FastBack', 'Back', 'Up', 'Forward', 
'FastForward',
+                             ' ', ' ', ' ', ' ',
+                             'Top', 'Contents', 'Index', 'About' ],
   'misc_elements_targets'   => {
                              'Overview' => 'SEC_Overview',
                              'Contents' => 'SEC_Contents',
@@ -1122,30 +1136,44 @@
   my $element_id = $self->command_id($command);
   $result .= "<a name=\"$element_id\"></a>\n" if (defined($element_id));
 
+  print STDERR "Process $command "
+        .Texinfo::Structuring::_print_root_command_texi($command)."\n"
+          if ($self->get_conf('DEBUG'));
   my $element;
   if ($root_commands{$command->{'cmdname'}} and $command->{'parent'}
       and $command->{'parent'}->{'type'} 
       and $command->{'parent'}->{'type'} eq 'element') {
     $element = $command->{'parent'};
+    print STDERR "Element $element (@{$element->{'contents'}}) ".
+       Texinfo::Structuring::_print_element_command_texi($element) ."\n"
+          if ($self->get_conf('DEBUG'));
+    #print STDERR "First in element: "
+    #    .Texinfo::Parser::_print_current($element->{'contents'}->[0])
+    #      if ($self->get_conf('DEBUG'));
     # First command in the element
-    if ($element->{'contents'}->[0] eq $command 
-        # and thre is more than one element
+    if (($element->{'contents'}->[0] eq $command
+         or (!$element->{'contents'}->[0]->{'cmdname'} 
+              and $element->{'contents'}->[1] eq $command))
+        # and there is more than one element
         and ($element->{'element_next'} or $element->{'element_prev'})) {
-      my ($previous_is_top, $is_top);
+      my ($previous_is_top, $is_top) = (0, 0);
       my $first_in_page = ($element->{'parent'} 
                and $element->{'parent'}->{'contents'}->[0] eq $element);
-      if ($element->{'global_target_elements'}->{'Top'}) {
+      if ($self->{'global_target_elements'}->{'Top'}) {
         # it is considered 'top' only if element corresponds to @top or 
         # element is a node
-        $is_top = ($element->{'global_target_elements'}->{'Top'} eq $element
+        $is_top = ($self->{'global_target_elements'}->{'Top'} eq $element
             and $element->{'extra'}
             and (($element->{'extra'}->{'section'} 
                   and $element->{'extra'}->{'section'}->{'cmdname'} eq 'top')
                  or ($element->{'extra'}->{'element_command'}
                      and $element->{'extra'}->{'element_command'}->{'cmdname'} 
eq 'node')));
-       $previous_is_top = ($element->{'element_prev'} 
-          and $element->{'global_target_elements'}->{'Top'} eq 
$element->{'element_prev'});
+       $previous_is_top = (defined($element->{'element_prev'}) 
+          and $self->{'global_target_elements'}->{'Top'} eq 
$element->{'element_prev'});
       }
+      print STDERR "Header ($previous_is_top, $is_top, $first_in_page): "
+        .Texinfo::Structuring::_print_root_command_texi($command)."\n"
+          if ($self->get_conf('DEBUG'));
       if ($is_top) {
         # FIXME clarify this
         # this is here because we want to always print the head navigation for 
top



reply via email to

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