texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo Structuring.pm Convert/HTML.pm


From: Patrice Dumas
Subject: texinfo/tp/Texinfo Structuring.pm Convert/HTML.pm
Date: Sat, 09 Apr 2011 09:25:44 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/04/09 09:25:44

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

Log message:
        Fix directions setting for element node and directions use.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.11&r2=1.12

Patches:
Index: Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- Structuring.pm      7 Apr 2011 23:08:04 -0000       1.49
+++ Structuring.pm      9 Apr 2011 09:25:44 -0000       1.50
@@ -736,6 +736,7 @@
         $directions->{'FastForward'}->{'extra'}->{'directions'}->{'FastBack'}  
           = $section if ($directions->{'FastForward'});
       }
+    }
       if ($element->{'extra'}->{'directions'}) {
         %{$element->{'extra'}->{'directions'}} = 
(%{$element->{'extra'}->{'directions'}}, 
                                                   %$directions)
@@ -743,7 +744,6 @@
         $element->{'extra'}->{'directions'} = $directions;
       }
     }
-  }
 }
 
 # this is used in the test suite, but not likely to be useful in real life.

Index: Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Convert/HTML.pm     7 Apr 2011 23:08:04 -0000       1.11
+++ Convert/HTML.pm     9 Apr 2011 09:25:44 -0000       1.12
@@ -852,12 +852,46 @@
   $no_unidecode = 1 if (defined($self->get_conf('USE_UNIDECODE')) 
                         and !$self->get_conf('USE_UNIDECODE'));
 
+  if ($self->{'labels'}) {
+    foreach my $root_command (values(%{$self->{'labels'}})) {
+      my $target = _normalized_to_id($root_command->{'extra'}->{'normalized'});
+      my $id = $target;
+      # FIXME something special for Top node ?
+      if (defined($Texinfo::Config::node_target_name)) {
+        ($target, $id) = &$Texinfo::Config::node_target_name($root_command,
+                                                             $target, $id);
+      }
+      my $filename;
+      if ($self->get_conf('TRANSLITERATE_FILE_NAMES')) {
+        $filename = 
Texinfo::Convert::NodeNameNormalization::transliterate_texinfo(
+          {'contents' => $root_command->{'extra'}->{'node_content'}},
+              $no_unidecode);
+      } else {
+        $filename = $root_command->{'extra'}->{'normalized'};
+      }
+      $filename .= '.'.$self->get_conf('NODE_FILE_EXTENSION') 
+        if (defined($self->get_conf('NODE_FILE_EXTENSION')) 
+            and $self->get_conf('NODE_FILE_EXTENSION') ne '');
+      if (defined($Texinfo::Config::node_file_name)) {
+        $filename = &$Texinfo::Config::node_file_name($self, $root_command,
+                                                     $filename);
+      }
+      if ($self->get_conf('DEBUG')) {
+        print STDERR "Register label $target, $filename\n";
+      }
+      $self->{'targets'}->{$root_command} = {'target' => $target, 
+                                             'id' => $id,
+                                             'filename' => $filename};
+    }
+  }
+
   if ($elements) {
     foreach my $element (@$elements) {
       foreach my $root_command(@{$element->{'contents'}}) {
         # FIXME this happens before the first element, for type 'text_root'.
         # What should be done in that case?
-        next if (!defined($root_command->{'cmdname'}));
+        next if (!defined($root_command->{'cmdname'}) 
+                 or $self->{'targets'}->{$root_command});
         if ($Texinfo::Common::root_commands{$root_command->{'cmdname'}}) {
           my $target_base = _normalized_to_id(
              Texinfo::Convert::NodeNameNormalization::transliterate_texinfo(
@@ -872,7 +906,8 @@
             die if ($nr == 0);
           }
           my $id = $target;
-          if ($root_command->{'associated_node'} and 
$self->get_conf('USE_NODE_TARGET')) {
+          if ($root_command->{'associated_node'} 
+              and $self->get_conf('USE_NODE_TARGET')) {
             $id = 
$self->{'targets'}->{$root_command->{'associated_node'}}->{'id'};
           }
           if (defined($Texinfo::Config::sectioning_command_target_name)) {
@@ -881,42 +916,15 @@
                                                                $root_command,
                                                                $target, $id);
           }
+          if ($self->get_conf('DEBUG')) {
+            print STDERR "Register $root_command->{'cmdname'} $target, $id\n";
+          }
           $self->{'targets'}->{$root_command} = {'target' => $target, 
                                                  'id' => $id};
         }
       }
     }
   }
-
-  if ($self->{'labels'}) {
-    foreach my $root_command (values(%{$self->{'labels'}})) {
-      my $target = _normalized_to_id($root_command->{'extra'}->{'normalized'});
-      my $id = $target;
-      # FIXME something special for Top node ?
-      if (defined($Texinfo::Config::node_target_name)) {
-        ($target, $id) = &$Texinfo::Config::node_target_name($root_command,
-                                                           $target, $id);
-      }
-      my $filename;
-      if ($self->get_conf('TRANSLITERATE_FILE_NAMES')) {
-        $filename = 
Texinfo::Convert::NodeNameNormalization::transliterate_texinfo(
-          {'contents' => $root_command->{'extra'}->{'node_content'}},
-              $no_unidecode);
-      } else {
-        $filename = $root_command->{'extra'}->{'normalized'};
-      }
-      $filename .= '.'.$self->get_conf('NODE_FILE_EXTENSION') 
-        if (defined($self->get_conf('NODE_FILE_EXTENSION')) 
-            and $self->get_conf('NODE_FILE_EXTENSION') ne '');
-      if (defined($Texinfo::Config::node_file_name)) {
-        $filename = &$Texinfo::Config::node_file_name($self, $root_command,
-                                                     $filename);
-      }
-      $self->{'targets'}->{$root_command} = {'target' => $target, 
-                                             'id' => $id,
-                                             'filename' => $filename};
-    }
-  }
 }
 
 sub _set_page_file($$$)
@@ -1082,6 +1090,7 @@
   'href' => 1,
   'string' => 1,
   'text' => 1,
+  'tree' => 1,
 );
 
 # FIXME global targets
@@ -1093,6 +1102,7 @@
   my $type = shift;
   my $filename = shift;
 
+  my $element_target;
   my $command;
   my $target;
  
@@ -1102,13 +1112,11 @@
   }
 
   if ($element->{'extra'} and $element->{'extra'}->{'directions'}
-      and $element->{'extra'}->{'directions'}->{$direction}
-      and 
$self->{'targets'}->{$element->{'extra'}->{'directions'}->{$direction}})
-  {
-    $command
-     = $element->{'extra'}->{'directions'}->{$direction}->{'element_command'};
-    $target = 
-      $self->{'targets'}->{$element->{'extra'}->{'directions'}->{$direction}};
+      and $element->{'extra'}->{'directions'}->{$direction}) {
+    $element_target 
+     = $element->{'extra'}->{'directions'}->{$direction};
+    $command = $element_target->{'extra'}->{'element_command'};
+    $target = $self->{'targets'}->{$command};
   } else {
     return undef;
   }
@@ -1125,7 +1133,6 @@
   } elsif (exists($target->{$type})) {
     return $target->{$type};
   } elsif ($command) {
-    
     my $tree;
     if (!$target->{'tree'}) {
       if ($command->{'cmdname'} eq 'node') {
@@ -1136,10 +1143,10 @@
       }
       $target->{'tree'} = $tree;
     } else {
+      return $target->{'tree'} if ($type eq 'tree');
       $tree = $target->{'tree'};
     }
 
-    return $target->{'tree'} if ($type eq 'tree');
     push @{$self->{'context'}}, 
             {'cmdname' => $command->{'cmdname'}};
     if ($type eq 'string') {
@@ -1149,8 +1156,7 @@
     if ($command->{'cmdname'} eq 'node') {
       $self->{'context'}->[-1]->{'code'} = 1;
     }
-    $target->{$type} = 
-      $self->_convert($tree);
+    $target->{$type} = $self->_convert($tree);
     pop @{$self->{'context'}}, 
     return $target->{$type};
   }
@@ -1171,6 +1177,8 @@
   if ($page and $page->{'extra'} and $page->{'extra'}->{'element'}) {
    my $element_string = 
$self->_element_direction($page->{'extra'}->{'element'},
                               'This', 'string');
+    # FIXME does not work and besides there is the issue of node node being
+    # formatted in code.
     if (defined($element_string) 
         and $element_string ne $self->{'title_string'}) {
       my $title_tree = $self->gdt('{title}: {element_text}', 
@@ -1322,6 +1330,12 @@
     $self->set_conf('NODE_FILENAMES', 1);
   }
                                                    
+  $self->_prepare_css();
+
+  # this sets OUTFILE, to be used if not split, but also
+  # 'destination_directory' and 'output_filename' that are useful when split.
+  $self->_set_outfile();
+
   # This should return undef if called on a tree without node or sections.
   my $elements = $self->_prepare_elements($root);
 
@@ -1333,23 +1347,17 @@
   # TODO handle special elements, footnotes element, contents and shortcontents
   # elements, titlepage association
 
-  # this sets OUTFILE, to be used if not split, but also
-  # 'destination_directory' and 'output_filename' that are useful when split.
-  $self->_set_outfile();
-
-  $self->_prepare_css();
-
   # determine file names associated with the different pages.
   $self->_set_page_files($pages);
 
-  # Add element directions
+  # Add element directions.  FIXME do it here or before?  Here it means that
+  # PrevFil eand NextFile can be set.
   Texinfo::Structuring::element_directions($self, $elements);
 
   # FIXME Before that, set multiple commands
+  # FIXME set language and documentencoding/encoding_name
   $self->set_conf('BODYTEXT',  'lang="' . $self->get_conf('documentlanguage') 
. '" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" 
alink="#FF0000"');
 
-
-  # FIXME set language and documentencoding/encoding_name
   # prepare title
   my $fulltitle;
   foreach my $fulltitle_command('settitle', 'title', 



reply via email to

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