[Po4a-commits] "po4a/lib/Locale/Po4a Man.pm,1.158,1.159"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Fri Jul 14 22:09:09 UTC 2006


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv16100/lib/Locale/Po4a

Modified Files:
	Man.pm 
Log Message:
Sometimes, the .B or .I macros are followed by an argument which only
consist in a space. As the .B or .I macro is replaced by \fB or \fI,
the quotes are removed, and some \& must be used to keep the space
(otherwise the line will be considered empty by groff.
Add these \&, and do not force the translators to translate them if
the line only consists in \&, spaces and font modifiers.


Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- Man.pm	16 Jun 2006 18:45:15 -0000	1.158
+++ Man.pm	14 Jul 2006 22:09:06 -0000	1.159
@@ -641,7 +641,10 @@
         my $arguments = $2;
         my @args = splitargs($ref,$arguments);
         if ($macro eq 'B' || $macro eq 'I') {
+            # To keep the space(s), we must introduce some \&
+            @args = map { $_ =~ s/^(\s*)$/\\&$1\\&/s; $_ } @args;
             my $arg=join(" ", at args);
+            $arg =~ s/(\\&|\s)+$//;
             $arg =~ s/^ +//;
             this_macro_needs_args($macro,$ref,$arg);
             $line = "$insert_font\\f$macro".$arg."\\fR\n";
@@ -999,6 +1002,9 @@
     
     return $str unless (defined $str) && length($str);
     return $str if ($str eq "\n");
+    # Do not translate the strings that only consist of fonts, spaces and
+    # \&. This is usefull because we introduced \& in shiftline.
+    return $str if ($str =~ m/^($FONT_RE|\s|\\&)*$/);
 
     $str=pre_trans($self,$str,$ref||$self->{ref},$type);
     $options{'comment'} .= join('\n', @comments);




More information about the Po4a-commits mailing list