[Po4a-commits] "po4a/lib/Locale/Po4a TeX.pm,1.96,1.97"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Mon Jul 14 15:45:50 UTC 2008


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv32265/lib/Locale/Po4a

Modified Files:
	TeX.pm 
Log Message:
	* lib/Locale/Po4a/TeX.pm: In Halibut, some command name have
	digits. Use the alnum class instead of alpha.
	* lib/Locale/Po4a/TeX.pm: Improve the handling of trailing and
	leading spaces.


Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- TeX.pm	19 Sep 2007 21:32:30 -0000	1.96
+++ TeX.pm	14 Jul 2008 15:45:47 -0000	1.97
@@ -469,7 +469,7 @@
     print STDERR "get_leading_command($buffer)="
         if ($debug{'extract_commands'});
 
-    if ($buffer =~ m/^$RE_ESCAPE([[:alpha:]]+)(\*?)(.*)$/s
+    if ($buffer =~ m/^$RE_ESCAPE([[:alnum:]]+)(\*?)(.*)$/s
         && defined $separated_command{$1}) {
         # The buffer begin by a comand (possibly preceded by some
         # whitespaces).
@@ -588,7 +588,7 @@
     }
 
     # There should now be a command, maybe followed by an asterisk.
-    if ($buffer =~ m/^(.*)$RE_ESCAPE([[:alpha:]]+)(\*?)\s*$/s
+    if ($buffer =~ m/^(.*)$RE_ESCAPE([[:alnum:]]+)(\*?)\s*$/s
         && defined $separated_command{$2}) {
         $buffer = $1;
         $command = $2;
@@ -738,7 +738,7 @@
         if ($buffer =~ /^(\s+)(.*?)$/s) {
             $spaces = $1;
 #            $buffer = $2; # FIXME: this also remove trailing spaces!!
-            $buffer =~ s/^\s*//;
+            $buffer =~ s/^\s*//s;
         }
         my $buffer_save = $buffer;
         ($command, $variant, $args, $buffer) =
@@ -767,7 +767,7 @@
                 if ($buffer =~ /^(\s+)(.*?)$/s) {
                     $spaces = $1;
 #                    $buffer = $2;  # FIXME: this also remove trailing spaces!!
-                    $buffer =~ s/^\s*//;
+                    $buffer =~ s/^\s*//s;
                 }
                 $translated_buffer .= $spaces;
             } else {
@@ -846,16 +846,19 @@
         }
         $wrap = 0 if (defined $no_wrap and $no_wrap == 1);
         # Keep spaces at the end of the buffer.
-        my $spaces = "";
+        my $spaces_end = "";
         if ($buffer =~ /^(.*?)(\s+)$/s) {
-            $spaces = $2;
+            $spaces_end = $2;
             $buffer = $1;
         }
+        if ($wrap and $buffer =~ s/^(\s+)//s) {
+                $translated_buffer .= $1;
+        }
         $translated_buffer .= $self->translate($buffer,$self->{ref},
                                                @env?$env[-1]:"Plain text",
                                                "wrap" => $wrap);
         # Restore spaces at the end of the buffer.
-        $translated_buffer .= $spaces;
+        $translated_buffer .= $spaces_end;
     }
 
     # append the translation of the trailing commands
@@ -1384,7 +1387,7 @@
         }
         @e = @$env;
         my $wrap = 1;
-        $wrap = 0 if $no_wrap == 1;
+        $wrap = 0 if (defined $no_wrap and $no_wrap == 1);
         $translated = $self->translate($tmp,$self->{ref},
                                        @e?$e[-1]:"Plain text",
                                        "wrap" => $wrap);




More information about the Po4a-commits mailing list