texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Convert/Plaintext.pm t/27flo...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/Plaintext.pm t/27flo...
Date: Sat, 01 Jan 2011 19:13:02 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/01/01 19:13:02

Modified files:
        tp/Texinfo/Convert: Plaintext.pm 
        tp/t           : 27float.t 
        tp/t/results/float: footnote_in_caption.pl 

Log message:
        Don't advance footnote counts or do a footnote for @footnote in 
@caption.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/27float.t?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/float/footnote_in_caption.pl?cvsroot=texinfo&r1=1.1&r2=1.2

Patches:
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- Texinfo/Convert/Plaintext.pm        1 Jan 2011 16:11:00 -0000       1.46
+++ Texinfo/Convert/Plaintext.pm        1 Jan 2011 19:13:02 -0000       1.47
@@ -1140,15 +1140,23 @@
       }
       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'}++;
+        $self->{'footnote_index'}++ unless ($multiple_pass);
         $footnote_number = $self->{'footnote_index'};
       } else {
         $footnote_number = $NO_NUMBER_FOOTNOTE_SYMBOL;
       }
       push @{$self->{'pending_footnotes'}}, {'root' => $root, 
-                                             'number' => $footnote_number}; 
+                                             'number' => $footnote_number}
+          unless ($multiple_pass);
       return $formatter->{'container'}->add_text("($footnote_number)");
     } elsif ($command eq 'anchor') {
       $result = $formatter->{'container'}->add_pending_word();
@@ -1496,9 +1504,11 @@
             $caption = $float->{'extra'}->{'caption'};
           }
           if ($caption) {
+            push @{$self->{'context'}}, 'listoffloats';
             # FIXME should there be some indentation?
             my ($caption_text) = $self->_convert({'contents' => 
$caption->{'args'}->[0]->{'contents'},
                         'type' => $caption->{'cmdname'}.'_listoffloats'});
+            pop @{$self->{'context'}};
             while ($caption_text =~ 
s/^\s*(\p{Unicode::EastAsianWidth::InFullwidth}\s*|\S+\s*)//) {
               my $new_word = $1;
               $new_word =~ s/\n//g;

Index: t/27float.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/27float.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- t/27float.t 1 Jan 2011 18:57:36 -0000       1.3
+++ t/27float.t 1 Jan 2011 19:13:02 -0000       1.4
@@ -18,7 +18,7 @@
 ['footnote_in_caption',
 '@listoffloats fl
 
address@hidden label, fl
address@hidden fl, label
 In float.
 @caption{in address@hidden footnote}}
 @end float

Index: t/results/float/footnote_in_caption.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/float/footnote_in_caption.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/float/footnote_in_caption.pl      1 Jan 2011 18:57:36 -0000       
1.1
+++ t/results/float/footnote_in_caption.pl      1 Jan 2011 19:13:02 -0000       
1.2
@@ -61,7 +61,7 @@
             },
             {
               'parent' => {},
-              'text' => 'label'
+              'text' => 'fl'
             }
           ],
           'parent' => {},
@@ -75,7 +75,7 @@
             },
             {
               'parent' => {},
-              'text' => 'fl'
+              'text' => 'label'
             },
             {
               'parent' => {},
@@ -175,12 +175,12 @@
         'node_content' => [
           {}
         ],
-        'normalized' => 'fl',
+        'normalized' => 'label',
         'type' => {
           'content' => [
             {}
           ],
-          'normalized' => 'label'
+          'normalized' => 'fl'
         }
       },
       'line_nr' => {
@@ -236,7 +236,7 @@
 
 $result_texis{'footnote_in_caption'} = '@listoffloats fl
 
address@hidden label, fl
address@hidden fl, label
 In float.
 @caption{in address@hidden footnote}}
 @end float
@@ -252,7 +252,7 @@
 
 
 $result_floats{'footnote_in_caption'} = {
-  'label' => [
+  'fl' => [
     {
       'cmdname' => 'float',
       'extra' => {
@@ -262,27 +262,31 @@
             'float' => {}
           }
         },
-        'normalized' => 'fl',
+        'normalized' => 'label',
         'type' => {
           'content' => [
             {
-              'text' => 'label'
+              'text' => 'fl'
             }
           ],
-          'normalized' => 'label'
+          'normalized' => 'fl'
         }
       },
       'number' => 1
     }
   ]
 };
-$result_floats{'footnote_in_caption'}{'label'}[0]{'extra'}{'caption'}{'extra'}{'float'}
 = $result_floats{'footnote_in_caption'}{'label'}[0];
+$result_floats{'footnote_in_caption'}{'fl'}[0]{'extra'}{'caption'}{'extra'}{'float'}
 = $result_floats{'footnote_in_caption'}{'fl'}[0];
 
 
 
 $result_converted{'plaintext'}->{'footnote_in_caption'} = '
+* Menu:
+
+* fl 1: label.                           in caption(0)
+
 In float.
-label 1: in caption(1)
+fl 1: in caption(1)
 
    ---------- Footnotes ----------
 



reply via email to

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