texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Convert/Plaintext.pm


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Convert/Plaintext.pm
Date: Sun, 06 Feb 2011 21:17:21 +0000

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

Modified files:
        tp             : TODO 
        tp/Texinfo/Convert: Plaintext.pm 

Log message:
        Don't enter index entries and anchor of caption when expanded in 
        @listoffloats.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.73&r2=1.74

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- TODO        6 Feb 2011 19:49:58 -0000       1.76
+++ TODO        6 Feb 2011 21:17:20 -0000       1.77
@@ -15,6 +15,8 @@
 @ protecting end of lines in @def* is not kept in any way in the tree.
 Maybe it could be possible to have it as a 'type'?
 
+test @anchor, @footnote and @cindex in @caption with @listoffloats.
+
 for i18n, one want to do something like
 {style} {number}: {caption}
   -> new tree. 

Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- Texinfo/Convert/Plaintext.pm        6 Feb 2011 19:49:58 -0000       1.73
+++ Texinfo/Convert/Plaintext.pm        6 Feb 2011 21:17:21 -0000       1.74
@@ -960,8 +960,7 @@
   my $self = shift;
   my $anchor = shift;
 
-  # 'lines_count' is in fact only needed when in @flush and @multitable
-  $self->_add_location($anchor);
+  $self->_add_location($anchor) unless ($self->{'multiple_pass'});
   return '';
 }
 
@@ -1293,23 +1292,16 @@
       }
       return '';
     } elsif ($command eq 'footnote') {
-      my $multiple_pass = 0;
-      foreach my $context (reverse (@{$self->{'context'}})) {
-        if ($context eq 'listoffloats') {
-          $multiple_pass = 1;
-          last;
-        }
-      }
       my $footnote_number;
       if ($self->{'NUMBER_FOOTNOTES'}) {
-        $self->{'footnote_index'}++ unless ($multiple_pass);
+        $self->{'footnote_index'}++ unless ($self->{'multiple_pass'});
         $footnote_number = $self->{'footnote_index'};
       } else {
         $footnote_number = $NO_NUMBER_FOOTNOTE_SYMBOL;
       }
       push @{$self->{'pending_footnotes'}}, {'root' => $root, 
                                              'number' => $footnote_number}
-          unless ($multiple_pass);
+          unless ($self->{'multiple_pass'});
       return $self->_count_added($formatter->{'container'},
                $formatter->{'container'}->add_text("($footnote_number)"));
     } elsif ($command eq 'anchor') {
@@ -1715,6 +1707,7 @@
              = Texinfo::Convert::Unicode::string_width($float_line);
           if ($line_width > $listoffloat_entry_length) {
             $float_line .= "\n" . ' ' x $listoffloat_entry_length;
+            $lines_count++;
           } else {
             $float_line .= ' ' x ($listoffloat_entry_length - $line_width);
           }
@@ -1726,11 +1719,14 @@
             $caption = $float->{'extra'}->{'caption'};
           }
           if ($caption) {
+            $self->{'multiple_pass'} = 1;
             push @{$self->{'context'}}, 'listoffloats';
             # FIXME should there be some indentation?
-            my ($caption_text) = $self->_convert({'contents' => 
$caption->{'args'}->[0]->{'contents'},
+            my $caption_text = $self->_convert({
+                     'contents' => $caption->{'args'}->[0]->{'contents'},
                         'type' => $caption->{'cmdname'}.'_listoffloats'});
             my $old_context = pop @{$self->{'context'}};
+            delete $self->{'multiple_pass'};
             die if ($old_context ne 'listoffloats');
             while ($caption_text =~ 
s/^\s*(\p{Unicode::EastAsianWidth::InFullwidth}\s*|\S+\s*)//) {
               my $new_word = $1;
@@ -1810,7 +1806,8 @@
     }
     
   }
-  if ($root->{'extra'} and $root->{'extra'}->{'index_entry'}) {
+  if ($root->{'extra'} and $root->{'extra'}->{'index_entry'}
+      and !$self->{'multiple_pass'}) {
     my $location = $self->_add_location($root);
     # remove a 'lines' from $location if at the very end of a node
     # since it will lead to the next node otherwise.



reply via email to

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