[Po4a-commits] "po4a/lib/Locale/Po4a Man.pm,1.101,1.102"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Fri Sep 2 19:19:48 UTC 2005


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

Modified Files:
	Man.pm 
Log Message:
Avoid more conversions of - to \-


Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- Man.pm	2 Sep 2005 19:12:41 -0000	1.101
+++ Man.pm	2 Sep 2005 19:19:45 -0000	1.102
@@ -632,7 +632,24 @@
     # (this shouldn't be done for \s-<number> font size modifiers)
     # nor on .so/.mso args
     unless (defined $self->{type} && $self->{type} =~ m/^m?so$/) {
-        $str =~ s/(?<!\\s)-/\\-/sg; # (?<!pattern) means "not preceded by pattern"
+        my $tmp = "";
+        while ($str =~ m/^(.*?)-(.*)$/s) {
+            my $begin = $1;
+            $str = $2;
+            my $tmp2 = $tmp.$begin;
+            if (   ($begin =~ m/\\s$/s)
+                or ($begin =~ m/\\\((.|E<[gl]t>)$/s)
+                or ($tmp2 =~ m/\\h'([^']|\\')*$/)) {
+                # Do not change - to \- for
+                #  * \s-n (reduce font size)
+                #  * \(.- (a character named '.-', e.g. '<-')
+                #  * inside a \h'...'
+                $tmp = $tmp2."-";
+            } else {
+                $tmp = $tmp2."\\-";
+            }
+        }
+        $str = $tmp.$str;
     }
 
     # No . or ' on first char, or nroff will think it's a macro




More information about the Po4a-commits mailing list