texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp t/08misc_commands.t t/test_utils.pl ...


From: Patrice Dumas
Subject: texinfo/tp t/08misc_commands.t t/test_utils.pl ...
Date: Sun, 08 Jul 2012 08:25:05 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/07/08 08:25:05

Modified files:
        tp/t           : 08misc_commands.t test_utils.pl 
        tp/Texinfo/Convert: Plaintext.pm Info.pm HTML.pm 

Log message:
        Fix empty @center count context not being popped when @center has an 
        argument but expands to the empty string.  Report from Karl.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/08misc_commands.t?cvsroot=texinfo&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.118&r2=1.119
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.212&r2=1.213
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.83&r2=1.84
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.236&r2=1.237

Patches:
Index: t/08misc_commands.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/08misc_commands.t,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- t/08misc_commands.t 17 May 2012 11:12:17 -0000      1.29
+++ t/08misc_commands.t 8 Jul 2012 08:25:04 -0000       1.30
@@ -317,6 +317,9 @@
 ['empty_center',
 '@center 
 '],
+['empty_center_with_arg',
+'@center @w{}
+'],
 ['ref_in_center',
 '@node Top
 

Index: t/test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -b -r1.118 -r1.119
--- t/test_utils.pl     20 May 2012 18:50:41 -0000      1.118
+++ t/test_utils.pl     8 Jul 2012 08:25:05 -0000       1.119
@@ -698,6 +698,8 @@
       my $format_converter_options = {%$converter_options};
       my $format_type = $format;
       if ($format_type =~ s/^file_//) {
+        # the information that the results is a file is passed
+        # through $format_converter_options->{'SUBDIR'} being defined
         my $base = "t/results/$self->{'name'}/$test_name/";
         my $test_out_dir;
         if ($self->{'generate'}) {

Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -b -r1.212 -r1.213
--- Texinfo/Convert/Plaintext.pm        15 Jun 2012 00:37:21 -0000      1.212
+++ Texinfo/Convert/Plaintext.pm        8 Jul 2012 08:25:05 -0000       1.213
@@ -370,6 +370,25 @@
   return $self;
 }
 
+sub _count_context_bug_message($$$)
+{
+  my $self = shift;
+  my $precision = shift; 
+  my $element = shift;
+
+  my $element_text;
+  if ($element) {
+    $element_text = 
Texinfo::Structuring::_print_element_command_texi($element);
+  } else {
+    $element_text = '';
+  }
+  if (scalar(@{$self->{'count_context'}}) != 1) {
+    $self->_bug_message("Too much count_context ${precision}(".
+      scalar(@{$self->{'count_context'}}). "): ". $element_text, $element);
+    die;
+  }
+}
+
 sub _convert_node($$)
 {
   my $self = shift;
@@ -378,14 +397,17 @@
   my $result = '';
 
   print STDERR "NEW NODE\n" if ($self->get_conf('DEBUG'));
-  die "Too much count_context\n" if (scalar(@{$self->{'count_context'}}) != 1);
 
   $result .= $self->_convert($element);
 
+  $self->_count_context_bug_message('', $element);
+
   print STDERR "END NODE 
($self->{'count_context'}->[-1]->{'lines'},$self->{'count_context'}->[-1]->{'bytes'})\n"
 if ($self->get_conf('DEBUG'));
 
   $result .= $self->_footnotes($element);
 
+  $self->_count_context_bug_message('footnotes ', $element);
+
   print STDERR "AFTER FOOTNOTES 
($self->{'count_context'}->[-1]->{'lines'},$self->{'count_context'}->[-1]->{'bytes'})\n"
 if ($self->get_conf('DEBUG'));
 
   return $result;
@@ -402,7 +424,9 @@
   $self->{'empty_lines_count'} = 1;
   if (!defined($elements)) {
     $result = $self->_convert($root);
+    $self->_count_context_bug_message('no element ');
     my $footnotes = $self->_footnotes();
+    $self->_count_context_bug_message('no element footnotes ');
     $result .= $footnotes;
   } else {
     foreach my $node (@$elements) {
@@ -2123,6 +2147,9 @@
         $result = $self->_align_environment ($result, 
              $self->{'text_element_context'}->[-1]->{'max'}, 'center'); 
         $self->{'empty_lines_count'} = 0;
+      } else {
+        # it has to be done here, as it is done in _align_environment above
+        pop @{$self->{'count_context'}};
       }
       $self->{'format_context'}->[-1]->{'paragraph_count'}++;
       return $result;

Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- Texinfo/Convert/Info.pm     27 May 2012 10:45:13 -0000      1.83
+++ Texinfo/Convert/Info.pm     8 Jul 2012 08:25:05 -0000       1.84
@@ -90,7 +90,11 @@
   if (!defined($elements) or $elements->[0]->{'extra'}->{'no_node'}) {
     $self->document_warn($self->__("Document without nodes."));
     my $output = $header.$self->_convert($root);
+    $self->_count_context_bug_message('no element ');
+
     my $footnotes = $self->_footnotes();
+    $self->_count_context_bug_message('no element footnotes ');
+
     $output .= $footnotes;
     if ($fh) {
       print $fh $output;

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.236
retrieving revision 1.237
diff -u -b -r1.236 -r1.237
--- Texinfo/Convert/HTML.pm     15 Jun 2012 00:37:21 -0000      1.236
+++ Texinfo/Convert/HTML.pm     8 Jul 2012 08:25:05 -0000       1.237
@@ -5242,7 +5242,7 @@
           }
           if (!defined($file_element->{'filename'})) {
             # use section to do the file name if there is no node
-            my $command = $self->element_command($file_element);;
+            my $command = $self->element_command($file_element);
             if ($command) {
               if ($command->{'cmdname'} eq 'top' and !$node_top
                   and defined($top_node_filename)) {



reply via email to

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