texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Common.pm Texinfo/Convert/Co...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Common.pm Texinfo/Convert/Co...
Date: Thu, 29 Sep 2011 15:17:09 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/29 15:17:09

Modified files:
        tp/Texinfo     : Common.pm 
        tp/Texinfo/Convert: Converter.pm Text.pm 
        tp/t           : accents.t 

Log message:
        Get rid of the innermost accent return value of 
find_innermost_accent_contents
        and _find_innermost_accent as it is simply the top stack accent.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.67&r2=1.68
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/accents.t?cvsroot=texinfo&r1=1.12&r2=1.13

Patches:
Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- Texinfo/Common.pm   29 Sep 2011 13:57:20 -0000      1.67
+++ Texinfo/Common.pm   29 Sep 2011 15:17:06 -0000      1.68
@@ -882,7 +882,7 @@
   return $result;
 }
 
-# find the innermost accent and the correspponding text contents
+# find the accent commands stack and the innermost text contents
 sub find_innermost_accent_contents($;$)
 {
   my $current = shift;
@@ -903,12 +903,12 @@
     push @accent_commands, $current;
     # A bogus accent
     if (!$current->{'args'}) {
-      return ([], $current, address@hidden);
+      return ([], address@hidden);
     }
     my $arg = $current->{'args'}->[0];
     # a construct like @'e without content
     if (defined($arg->{'text'})) {
-      return ([$arg], $current, address@hidden);
+      return ([$arg], address@hidden);
     }
     if (!$arg->{'contents'}) {
       print STDERR "BUG: No content in accent command\n";
@@ -931,7 +931,7 @@
       }
     }
     # we go here if there was no nested accent
-    return ($text_contents, $current, address@hidden);
+    return ($text_contents, address@hidden);
   }
 }
 

Index: Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- Texinfo/Convert/Converter.pm        29 Sep 2011 14:04:40 -0000      1.45
+++ Texinfo/Convert/Converter.pm        29 Sep 2011 15:17:07 -0000      1.46
@@ -833,10 +833,10 @@
                                       $in_upper_case);
     }
   }
-  my ($contents, $innermost_accent, $stack)
+  my ($contents, $stack)
       = Texinfo::Common::find_innermost_accent_contents($accent);
-  my $result = $self->_convert({'contents' => $contents});
   
+  my $result = $self->_convert({'contents' => $contents});  
   foreach my $accent_command (reverse(@$stack)) {
     $result = &$format_accents ($result, $accent_command, 
                                 $in_upper_case);

Index: Texinfo/Convert/Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- Texinfo/Convert/Text.pm     29 Sep 2011 14:36:29 -0000      1.63
+++ Texinfo/Convert/Text.pm     29 Sep 2011 15:17:08 -0000      1.64
@@ -162,13 +162,13 @@
   my $current = shift;
   my $encoding = shift;
   my $in_upper_case = shift;
-  my ($contents, $innermost_accent, $stack) 
+  my ($contents, $stack)
       = Texinfo::Common::find_innermost_accent_contents($current);
   my $options = {};
   $options->{'enabled_encoding'} = $encoding if (defined($encoding));
   $options->{'sc'} = $in_upper_case if (defined($in_upper_case));
   return (convert({'contents' => $contents}, $options), 
-          $innermost_accent, $stack);
+          $stack);
 }
 
 sub eight_bit_accents($$$;$)
@@ -183,16 +183,16 @@
 
   # FIXME shouldn't it be better to format the innermost contents with 
   # a converter, if present?
-  my ($text, $innermost_accent, $stack) 
+  my ($text, $stack) 
     = _find_innermost_accent($current, $encoding, $in_upper_case);
 
-  print STDERR "INNERMOST: $innermost_accent->{'cmdname'}($text)\n"
-    if ($debug);
-
+  if ($debug) {
+    print STDERR "stack: ".join('|', map {$_->{'cmdname'}} @$stack)."\n";
+  }
   # accents are formatted and the intermediate results are kept, such
   # that we can return the maximum of multiaccented letters that can be
   # rendered with a given eight bit formatting.
-  my $accent = $innermost_accent;
+  my $accent = $stack->[-1];
   my $current_result = $text;
   my @results_stack;
 
@@ -219,8 +219,7 @@
   }
 
   if ($debug) {
-    print STDERR "stack: ".join('|', map {$_->{'cmdname'}} @$stack)
-     ."\nPARTIAL_RESULTS_STACK:\n";
+    print STDERR "PARTIAL_RESULTS_STACK:\n";
     foreach my $partial_result (@results_stack) {
       if (defined($partial_result->[0])) {
         print STDERR "   -> ".Encode::encode('utf8', $partial_result->[0])
@@ -321,7 +320,7 @@
   my $current = shift;
   my $in_upper_case = shift;
 
-  my ($result, $innermost_accent, $stack) 
+  my ($result, $stack) 
     = _find_innermost_accent($current, undef, $in_upper_case);
 
   $result = uc($result) if ($in_upper_case and $result =~ /^\w$/);
@@ -337,7 +336,7 @@
   my $current = shift;
   my $format_accent = shift;
   my $in_upper_case = shift;
-  my ($result, $innermost_accent, $stack) = _find_innermost_accent($current,
+  my ($result, $stack) = _find_innermost_accent($current,
           'utf-8', $in_upper_case);
   my @stack_accent_commands = reverse(@$stack);
 

Index: t/accents.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/accents.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- t/accents.t 4 Sep 2011 18:13:17 -0000       1.12
+++ t/accents.t 29 Sep 2011 15:17:08 -0000      1.13
@@ -22,7 +22,7 @@
   my $reference = $test->[2]; 
   my $parser = Texinfo::Parser::parser({'context' => 'preformatted'});
   my $tree = $parser->parse_texi_text($texi);
-  my ($text, $innermost_accent, $commands_stack) = 
+  my ($text, $commands_stack) = 
     Texinfo::Convert::Text::_find_innermost_accent($tree->{'contents'}->[0]);
   my @stack = map {$_->{'cmdname'}} @$commands_stack;
   if (defined($reference)) {



reply via email to

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