texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Convert/Converter.pm t/test_...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Convert/Converter.pm t/test_...
Date: Sun, 09 Sep 2012 20:11:33 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/09/09 20:11:33

Modified files:
        tp/Texinfo/Convert: Converter.pm 
        tp/t           : test_utils.pl 

Log message:
        Ignore comments in trailing spaces determination.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.121&r2=1.122

Patches:
Index: Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- Texinfo/Convert/Converter.pm        2 Sep 2012 20:34:41 -0000       1.86
+++ Texinfo/Convert/Converter.pm        9 Sep 2012 20:11:33 -0000       1.87
@@ -705,16 +705,25 @@
     $result[0] = $arg->{'contents'}->[0]->{'text'};
     return @result if (scalar(@{$arg->{'contents'}}) == 1);
   }
-  if ($arg->{'contents'} and $arg->{'contents'}->[-1] 
-      and defined($arg->{'contents'}->[-1]->{'text'})
-      and $arg->{'contents'}->[-1]->{'text'} !~ /\S/
-      and defined($arg->{'contents'}->[-1]->{'type'})) {
-    #print STDERR "$arg->{'contents'}->[-1]->{'type'}\n";
-    warn "Unknown trailing space type $arg->{'contents'}->[-1]->{'type'}\n"
-      if ($arg->{'contents'}->[-1]->{'type'} ne 'spaces_at_end'
-          and $arg->{'contents'}->[-1]->{'type'} ne 
'space_at_end_block_command'
+  if ($arg->{'contents'}) {
+    my $index = -1;
+    $index-- if ($arg->{'contents'}->[-1] 
+                 and $arg->{'contents'}->[-1]->{'cmdname'}
+                 and ($arg->{'contents'}->[-1]->{'cmdname'} eq 'c'
+                      or $arg->{'contents'}->[-1]->{'cmdname'} eq 'comment'));
+    if (scalar(@{$arg->{'contents'}}) + $index > 0) {
+      if ($arg->{'contents'}->[$index] 
+          and defined($arg->{'contents'}->[$index]->{'text'})
+          and $arg->{'contents'}->[$index]->{'text'} !~ /\S/
+          and defined($arg->{'contents'}->[$index]->{'type'})) {
+      #print STDERR "$arg->{'contents'}->[$index]->{'type'}\n";
+        warn "Unknown trailing space type 
$arg->{'contents'}->[$index]->{'type'}\n"
+          if ($arg->{'contents'}->[$index]->{'type'} ne 'spaces_at_end'
+              and $arg->{'contents'}->[$index]->{'type'} ne 
'space_at_end_block_command'
          );
-    $result[1] = $arg->{'contents'}->[-1]->{'text'};
+        $result[1] = $arg->{'contents'}->[$index]->{'text'};
+      }
+    }
   }
   return @result;
 }

Index: t/test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- t/test_utils.pl     9 Sep 2012 16:51:47 -0000       1.121
+++ t/test_utils.pl     9 Sep 2012 20:11:33 -0000       1.122
@@ -1071,7 +1071,7 @@
   }
   my $node_top;
   my $top = '';
-  if ($test_text =~ /address@hidden +top\s/mi or $test_text =~ /address@hidden 
+top *$/mi) {
+  if ($test_text =~ /address@hidden +top[\s,]/mi or $test_text =~ 
/address@hidden +top *$/mi) {
     $node_top = '';
   } else {
     $node_top = "address@hidden Top\n";



reply via email to

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