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/resul...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/Plaintext.pm t/resul...
Date: Sun, 06 Feb 2011 00:32:42 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/02/06 00:32:41

Modified files:
        tp/Texinfo/Convert: Plaintext.pm 
        tp/t/results/float: footnote_in_caption.pl 
                            numbering_captions_listoffloats.pl simple.pl 
        tp/t/results/preformatted: caption_in_example.pl 

Log message:
        Fix vertical spacing between float and text and before caption.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/float/footnote_in_caption.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/float/numbering_captions_listoffloats.pl?cvsroot=texinfo&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/float/simple.pl?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/preformatted/caption_in_example.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.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- Texinfo/Convert/Plaintext.pm        5 Feb 2011 21:41:48 -0000       1.69
+++ Texinfo/Convert/Plaintext.pm        6 Feb 2011 00:32:41 -0000       1.70
@@ -900,7 +900,7 @@
   my $lines_count = 0;
   while ($section and $section ne $section_root) {
     push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
-    my ($section_title) = $self->convert_line({'contents'
+    my $section_title = $self->convert_line({'contents'
                 => $section->{'extra'}->{'misc_content'}});
     pop @{$self->{'count_context'}};
     my $text = Texinfo::Convert::Text::numbered_heading($section, 
@@ -1423,7 +1423,7 @@
       return $result;
     } elsif ($command eq 'titlefont') {
       push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
-      ($result) = $self->convert_line ($root->{'args'}->[0]);
+      $result = $self->convert_line ($root->{'args'}->[0]);
       pop @{$self->{'count_context'}};
       $result = Texinfo::Convert::Text::heading({'level' => 0, 
            'cmdname' => 'titlefont'}, $result, $self->{'NUMBER_SECTIONS'});
@@ -1506,10 +1506,12 @@
         $self->{'format_context'}->[-1]->{'columns_size'} = $columnsize;
         $self->{'format_context'}->[-1]->{'row_empty_lines_count'} 
           = $self->{'empty_lines_count'};
-      } elsif ($root->{'cmdname'} eq 'float' and $root->{'extra'}
-               and $root->{'extra'}->{'normalized'}) {
+      } elsif ($root->{'cmdname'} eq 'float') {
+        $result .= $self->_add_newline_if_needed();
+        if ($root->{'extra'} and $root->{'extra'}->{'normalized'}) {
         $result .= $self->_anchor($root);
       }
+      }
     } elsif ($root->{'cmdname'} eq 'node') {
       $result .= $self->_node($root);
       $self->{'format_context'}->[-1]->{'paragraph_count'} = 0;
@@ -1545,7 +1547,7 @@
       }
       if ($root->{'args'}) {
         push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
-        my ($heading) = $self->convert_line($root->{'args'}->[0]);
+        my $heading = $self->convert_line($root->{'args'}->[0]);
         pop @{$self->{'count_context'}};
         # FIXME address@hidden and @c?
         my $heading_underlined = 
@@ -1698,7 +1700,7 @@
                });
           }
           #print STDERR "$float ".$self->convert_line($float_entry)."\n";
-          my ($float_line) = $self->convert_line($float_entry);
+          my $float_line = $self->convert_line($float_entry);
           my $line_width 
              = Texinfo::Convert::Unicode::string_width($float_line);
           if ($line_width > $listoffloat_entry_length) {
@@ -2089,8 +2091,11 @@
         print STDERR "FLOAT: ($number) ($type_texi)\n";
       }
 
-      if ($root->{'extra'}) {
-        # FIXME add an end if line if there is not already one?
+      if ($root->{'extra'}
+          and ($root->{'extra'}->{'type'} or defined($root->{'number'})
+               or $root->{'extra'}->{'caption'} or 
$root->{'extra'}->{'shortcaption'})) {
+        
+        $result .= $self->_add_newline_if_needed();
         my $caption;
         if ($root->{'extra'}->{'caption'}) {
           $caption = $root->{'extra'}->{'caption'};
@@ -2145,6 +2150,7 @@
           $result .= $float_number;
           $self->{'format_context'}->[-1]->{'counter'} += 
             Texinfo::Convert::Unicode::string_width($float_number);
+          $self->{'empty_lines_count'} = 0;
         }
         if ($caption) {
           # FIXME not sure it is right.

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.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/float/footnote_in_caption.pl      1 Jan 2011 19:13:02 -0000       
1.2
+++ t/results/float/footnote_in_caption.pl      6 Feb 2011 00:32:41 -0000       
1.3
@@ -286,6 +286,7 @@
 * fl 1: label.                           in caption(0)
 
 In float.
+
 fl 1: in caption(1)
 
    ---------- Footnotes ----------

Index: t/results/float/numbering_captions_listoffloats.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/float/numbering_captions_listoffloats.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- t/results/float/numbering_captions_listoffloats.pl  1 Jan 2011 18:57:36 
-0000       1.10
+++ t/results/float/numbering_captions_listoffloats.pl  6 Feb 2011 00:32:41 
-0000       1.11
@@ -6807,9 +6807,11 @@
 No type but label and no caption nor shortcaption.
 
 2
+
 No label, no type, no caption no shortcaption.
 
 No label, no type, but caption and shortcaption.
+
 C No label, no type, but caption and shortcaption.
 
 Second float with no type.
@@ -6851,14 +6853,18 @@
 A text in float no caption a label a type.
 
 Text 1.3
+
 Unnumbered
 **********
 
 * Menu:
 
 * Section within unnumbered::
+
 unnum
+
 Text 5: C unnumbered float
+
 float with no type.
 
 5: C No type in unnumbered
@@ -6867,6 +6873,7 @@
 =============================
 
 Section within unnumbered
+
 Text 6: C Section within unnumbered
 
 2 Chapter with unnumbsubsec
@@ -6875,13 +6882,16 @@
 * Menu:
 
 * unnumbered sec::
+
 Chap
+
 Text 2.1: C Chapter with subsec
 
 unnumbered sec
 ==============
 
 Chap
+
 Text 2.2: C unnumbered sec float
 
 float with no type.
@@ -6892,6 +6902,7 @@
 *****************************
 
 Appendix
+
 Text A.1: C appendix sec float
 
 list of floats

Index: t/results/float/simple.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/float/simple.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- t/results/float/simple.pl   1 Jan 2011 18:57:36 -0000       1.5
+++ t/results/float/simple.pl   6 Feb 2011 00:32:41 -0000       1.6
@@ -204,6 +204,7 @@
 
 $result_converted{'plaintext'}->{'simple'} = '
 In float.
+
 Type 1: Caption.
 ';
 

Index: t/results/preformatted/caption_in_example.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/preformatted/caption_in_example.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/preformatted/caption_in_example.pl        30 Jan 2011 17:23:37 
-0000      1.1
+++ t/results/preformatted/caption_in_example.pl        6 Feb 2011 00:32:41 
-0000       1.2
@@ -248,6 +248,7 @@
 
 
      After caption
+
 float: caption
 ';
 



reply via email to

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