texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo/Convert Plaintext.pm


From: Patrice Dumas
Subject: texinfo/tp/Texinfo/Convert Plaintext.pm
Date: Sun, 05 Aug 2012 08:07:02 +0000

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

Modified files:
        tp/Texinfo/Convert: Plaintext.pm 

Log message:
        Minor improvements to quoted commands when nested handling.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.219&r2=1.220

Patches:
Index: Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.219
retrieving revision 1.220
diff -u -b -r1.219 -r1.220
--- Plaintext.pm        4 Aug 2012 22:45:44 -0000       1.219
+++ Plaintext.pm        5 Aug 2012 08:07:02 -0000       1.220
@@ -262,19 +262,20 @@
 my @quoted_commands = ('cite', 'code', 'command', 'env', 'file', 'kbd',
   'option', 'samp', 'indicateurl');
 
-# %quoted_code_commands have no quote when in code command contexts
-my %quoted_code_commands;
+# %non_quoted_commands_when_nested have no quote when in code command contexts
+my %non_quoted_commands_when_nested;
 
 # Quotes are reset in converter_initialize and unicode quotes are used 
 # if @documentencoding utf-8 is used.
 foreach my $quoted_command (@quoted_commands) {
   $style_map{$quoted_command} = ["'", "'"];
-  $quoted_code_commands{$quoted_command} = 1;
+  if ($code_style_commands{$quoted_command}) {
+    $non_quoted_commands_when_nested{$quoted_command} = 1;
+  }
 }
-
-delete $quoted_code_commands{'cite'};
-delete $quoted_code_commands{'samp'};
-delete $quoted_code_commands{'indicateurl'};
+# always quoted even when nested
+delete $non_quoted_commands_when_nested{'samp'};
+delete $non_quoted_commands_when_nested{'indicateurl'};
 
 $style_map{'key'} = ['<', '>'];
 
@@ -1584,7 +1585,7 @@
         $text_before = $root->{'extra'}->{'begin'};
         $text_after = $root->{'extra'}->{'end'};
       } else {
-        if ($quoted_code_commands{$command} 
+        if ($non_quoted_commands_when_nested{$command} 
             and $formatter->{'font_type_stack'}->[-1]->{'code_command'}) {
           $text_before = '';
           $text_after = '';
@@ -1595,7 +1596,7 @@
       }
       # do this after determining $text_before/$text_after such that it
       # doesn't impact the current command, but only commands nested within
-      if ($quoted_code_commands{$command}) {
+      if ($non_quoted_commands_when_nested{$command}) {
         $formatter->{'font_type_stack'}->[-1]->{'code_command'}++;
       }
       $result .= $self->_count_added($formatter->{'container'},
@@ -1635,7 +1636,7 @@
             if !$formatter->{'font_type_stack'}->[-1]->{'normal'};
         }
       }
-      if ($quoted_code_commands{$command}) {
+      if ($non_quoted_commands_when_nested{$command}) {
         #$formatter->{'code_command'}--;
         $formatter->{'font_type_stack'}->[-1]->{'code_command'}--;
       }



reply via email to

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