[Po4a-commits] po4a/lib/Locale/Po4a TeX.pm,1.1,1.2

Nicolas FRAN??OIS po4a-devel@lists.alioth.debian.org
Mon, 06 Dec 2004 21:26:48 +0000


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

Modified Files:
	TeX.pm 
Log Message:
Give examples of what can be done in pre/post_trans:
  - handle some accentuated characters
  - handle non-breaking spaces


Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- TeX.pm	6 Dec 2004 21:22:28 -0000	1.1
+++ TeX.pm	6 Dec 2004 21:26:46 -0000	1.2
@@ -91,6 +91,18 @@
     print STDERR "pre_trans($str)="
         if ($debug{'pretrans'});
 
+    # Accentuated characters
+    # FIXME: only do this if the encoding is UTF-8?
+    $str =~ s/\\`a/à/g;
+    $str =~ s/\\c{c}/ç/g;
+    $str =~ s/\\^e/ê/g;
+    $str =~ s/\\'e/é/g;
+    $str =~ s/\\`e/è/g;
+    $str =~ s/\\`u/ù/g;
+    $str =~ s/\\"i/ï/g;
+    # Non breaking space. FIXME: should we change $\sim$ to ~
+    $str =~ s/~/\xA0/g;
+
     print STDERR "$str\n" if ($debug{'pretrans'});
     return $str;
 }
@@ -101,6 +113,17 @@
 
     print STDERR "post_trans($str)="
         if ($debug{'postrans'});
+
+    # Accentuated characters
+    $str =~ s/à/\\`a/g;
+    $str =~ s/ç/\\c{c}/g;
+    $str =~ s/ê/\\^e/g;
+    $str =~ s/é/\\'e/g;
+    $str =~ s/è/\\`e/g;
+    $str =~ s/ù/\\`u/g;
+    $str =~ s/ï/\\"i/g;
+    # Non breaking space. FIXME: should we change ~ to $\sim$
+    $str =~ s/\xA0/~/g;
 
     print STDERR "$str\n" if ($debug{'postrans'});
     return $str;