texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo Parser.pm


From: Patrice Dumas
Subject: texinfo/tp/Texinfo Parser.pm
Date: Mon, 01 Nov 2010 08:31:15 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        10/11/01 08:31:15

Modified files:
        tp/Texinfo     : Parser.pm 

Log message:
        Associate floats with their type and their section.
        External subroutine to get the floats with type information.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.135&r2=1.136

Patches:
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- Parser.pm   1 Nov 2010 07:49:04 -0000       1.135
+++ Parser.pm   1 Nov 2010 08:31:14 -0000       1.136
@@ -57,6 +57,7 @@
   parse_texi_file
   errors
   indices_information
+  floats_information
 ) ] );
 
 @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
@@ -142,11 +143,14 @@
 # errors_warnings         a structure with the errors and warnings.
 # error_nrs               number of errors.
 # current_node            last seen node.
+# current_section         last seen section.
 # nodes                   list of nodes.
 # command_index_prefix    associate a command name to an index prefix.
 # prefix_to_index_name    associate an index prefix to the index name.
 # index_entries           key is an index name, value is an array reference
 #                         on index_entry.
+# floats                  key is the normalized float type, value is an array
+#                         reference holding all the floats.
 
 # A line information is an hash reference with the keys:
 # line_nr        the line number
@@ -958,7 +962,14 @@
 sub indices_information ($)
 {
   my $self = shift;
-  return ($self->{'index_names'}, $self->{'merged_indices'});
+  #return ($self->{'index_names'}, $self->{'merged_indices'});
+  return ($self->{'index_names'}, $self->{'merged_indices'}, 
$self->{'index_entries'});
+}
+
+sub floats_information ($)
+{
+  my $self = shift;
+  return $self->{'floats'};
 }
 
 # Following are the internal subsections.  The most important are
@@ -1977,7 +1988,14 @@
             _register_label($self, $float, $float_label, $line_nr);
           }
         }
-        _parse_float_type ($float);
+        if (_parse_float_type ($float)) {
+          my $type = $float->{'extra'}->{'type'}->{'normalized'};
+          push @{$self->{'floats'}->{$type}}, $float;
+          $float->{'float_section'} = $self->{'current_section'} 
+            if (defined($self->{'current_section'}));
+          #$float->{'float_node'} = $self->{'current_node'} 
+          #  if (defined($self->{'current_node'}));
+        }
       }
     }
     $current = $current->{'parent'};
@@ -2083,7 +2101,7 @@
         if (_register_label($self, $current, 
                     $current->{'extra'}->{'nodes_manuals'}->[0], $line_nr)) {
           $self->{'current_node'} = $current;
-          push @{$self->{'nodes'}}, $self->{'current_node'};
+          push @{$self->{'nodes'}}, $current;
         }
       }
     } elsif ($command eq 'listoffloats') {
@@ -2144,12 +2162,14 @@
       delete $current->{'remaining_args'};
       $current->{'contents'} = [];
       # associate the section (not part) with the current node.
-      if ($command ne 'node' and $command ne 'part'
-           and $self->{'current_node'}
+      if ($command ne 'node' and $command ne 'part') {
+        if ($self->{'current_node'}
            and !$self->{'current_node'}->{'extra'}->{'associated_section'}) {
         $self->{'current_node'}->{'extra'}->{'associated_section'} = $current;
         $current->{'extra'}->{'associated_node'} = $self->{'current_node'};
       }
+        $self->{'current_section'} = $current;
+      }
     }
    # do that last in order to have the line processed if one of the above
    # case is also set.



reply via email to

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