[Po4a-commits] po4a/lib/Locale/Po4a TeX.pm,1.9,1.10

Nicolas FRAN??OIS po4a-devel@lists.alioth.debian.org
Fri, 04 Feb 2005 20:56:48 +0000


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

Modified Files:
	TeX.pm 
Log Message:
Add support for more "% po4a:" commands.


Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- TeX.pm	4 Feb 2005 20:49:00 -0000	1.9
+++ TeX.pm	4 Feb 2005 20:56:46 -0000	1.10
@@ -645,14 +645,30 @@
     my ($self,$line)=@_;
     $line =~ s/^%\s+po4a:\s*//;
 
-    if ($line =~ /^command\s+(\w)\s+(.*)$/) {
+    if ($line =~ /^command\s+(\w+)\s+(.*)$/) {
         my $command = $1;
-        my $line = $2;
-        if ($line =~ /^alias\s+(\w)/) {
-            if (defined ($commands{$2})) {
-                $commands{$command} = $commands{$2}
+        $line = $2;
+        if ($line =~ /^alias\s+(\w+)\s*$/) {
+            if (defined ($commands{$1})) {
+                $commands{$command} = $commands{$1};
             } else {
                 die "Cannot use an alias to the unknown command $2\n";
+            }
+        } elsif ($line =~ /^(\w+)\s*$/) {
+            if (defined &$1) {
+                $commands{$command} = \&$1;
+            } else {
+                die "Unknown command ($1) for $command\n";
+            }
+        }
+    } elsif ($line =~ /^environment\s+(\w+)\s+(.*)$/) {
+        my $env = $1;
+        $line = $2;
+        if ($line =~ /^(\w+)\s*$/) {
+            if (defined &$1) {
+                $environments{$env} = \&$1;
+            } else {
+                die "Unknown environment ($1) for $env\n";
             }
         }
     }