texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo/Convert HTML.pm Text.pm Unic...


From: Patrice Dumas
Subject: texinfo/tp/Texinfo/Convert HTML.pm Text.pm Unic...
Date: Thu, 29 Sep 2011 14:22:21 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/29 14:22:21

Modified files:
        tp/Texinfo/Convert: HTML.pm Text.pm Unicode.pm 

Log message:
        Factor out code for unicode commands with brace no argument in 
        Texinfo::Convert::Unicode.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.156&r2=1.157
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Unicode.pm?cvsroot=texinfo&r1=1.16&r2=1.17

Patches:
Index: HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -b -r1.156 -r1.157
--- HTML.pm     29 Sep 2011 13:57:21 -0000      1.156
+++ HTML.pm     29 Sep 2011 14:22:20 -0000      1.157
@@ -4029,14 +4029,12 @@
            = $Texinfo::Config::commands_formatting{$context}->{$command};
       } else {
         if ($self->get_conf('ENABLE_ENCODING') 
-            and $self->{'encoding_name'} 
-            and 
$Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands{$command}
-            and ($self->{'encoding_name'} eq 'utf-8'
-                 or 
($Texinfo::Encoding::eight_bit_encoding_aliases{$self->{'encoding_name'}}
-                    and 
$Texinfo::Convert::Unicode::unicode_to_eight_bit{$Texinfo::Encoding::eight_bit_encoding_aliases{$self->{'encoding_name'}}}->{$Texinfo::Convert::Unicode::unicode_map{$command}}))
+            and Texinfo::Convert::Unicode::unicode_for_brace_no_arg_command(
+                           $command, $self->{'encoding_name'})
             and 
!$self->_use_entity_is_entity($default_commands_formatting{$context}->{$command}))
 {
           $self->{'commands_formatting'}->{$context}->{$command}
-            = 
$Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands{$command}
+            = Texinfo::Convert::Unicode::unicode_for_brace_no_arg_command(
+                           $command, $self->{'encoding_name'})
         } else {
           $self->{'commands_formatting'}->{$context}->{$command} 
             = $default_commands_formatting{$context}->{$command};

Index: Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- Text.pm     29 Sep 2011 13:57:21 -0000      1.61
+++ Text.pm     29 Sep 2011 14:22:21 -0000      1.62
@@ -410,19 +410,16 @@
      if ($root->{'extra'}
       and defined($root->{'extra'}->{'clickstyle'})
       and 
defined($text_brace_no_arg_commands{$root->{'extra'}->{'clickstyle'}}));
-  my $result;
-  if ($encoding
-      and (($encoding eq 'utf-8' 
-            and 
$Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands{$command})
-           or ($Texinfo::Encoding::eight_bit_encoding_aliases{$encoding}
-               and 
$unicode_to_eight_bit{$Texinfo::Encoding::eight_bit_encoding_aliases{$encoding}}->{$Texinfo::Convert::Unicode::unicode_map{$command}})))
 {
-    $result = 
$Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands{$command};
-  } elsif ($options and $options->{'sort_string'} 
+  my $result = Texinfo::Convert::Unicode::unicode_for_brace_no_arg_command(
+                       $command, $encoding);
+  if (!defined($result)) {
+    if ($options and $options->{'sort_string'} 
            and $sort_brace_no_arg_commands{$command}) {
     $result = $sort_brace_no_arg_commands{$command};
   } else {
     $result = $text_brace_no_arg_commands{$command};
   }
+  }
   if ($options and $options->{'sc'} 
       and $Texinfo::Common::letter_no_arg_commands{$command}) {
     $result = uc($result);

Index: Unicode.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Unicode.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- Unicode.pm  29 Sep 2011 08:18:14 -0000      1.16
+++ Unicode.pm  29 Sep 2011 14:22:21 -0000      1.17
@@ -1222,6 +1222,21 @@
   return Unicode::Normalize::NFC($text);
 }
 
+sub unicode_for_brace_no_arg_command($$) {
+  my $command = shift;
+  my $encoding = shift;
+  
+  if ($unicode_character_brace_no_arg_commands{$command}
+      and $encoding 
+      and ($encoding eq 'utf-8'
+           or ($Texinfo::Encoding::eight_bit_encoding_aliases{$encoding}
+               and 
$unicode_to_eight_bit{$Texinfo::Encoding::eight_bit_encoding_aliases{$encoding}}->{$unicode_map{$command}})))
 {
+    return $unicode_character_brace_no_arg_commands{$command};
+  } else {
+    return undef;
+  }  
+}
+
 # string length size taking into account that east asian characters
 # may take 2 spaces.
 sub string_width($)



reply via email to

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