[Po4a-commits] po4a/lib/Locale/Po4a TeX.pm,1.17,1.18

Nicolas FRAN??OIS po4a-devel@lists.alioth.debian.org
Tue, 15 Feb 2005 22:08:27 +0000


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

Modified Files:
	TeX.pm 
Log Message:
Support \input for file inclusion.
Surround files included by a \include with \clearpage commands.


Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- TeX.pm	15 Feb 2005 22:04:22 -0000	1.17
+++ TeX.pm	15 Feb 2005 22:08:25 -0000	1.18
@@ -613,23 +613,32 @@
     while (defined (my $textline = <$in>)) {
         $linenum++;
         my $ref="$filename:$linenum";
-        while ($textline =~ /^(.*)\\include\{([^\{]*)\}(.*)$/) {
-            my ($begin,$newfilename,$end) = ($1,$2,$3);
+        # FIXME: includeonly is not supported
+        while ($textline =~ /^(.*)\\(include|input)\{([^\{]*)\}(.*)$/) {
+            my ($begin,$newfilename,$end) = ($1,$3,$4);
+            my $tag = $2;
             my $include = 1;
             foreach my $f (@exclude_include) {
                 if ($f eq $newfilename) {
                     $include = 0;
-                    $begin .= "\\include{$newfilename}";
+                    $begin .= "\\$tag"."{$newfilename}";
                     $textline = $end;
                 }
             }
+            if ($include and ($tag eq "include")) {
+                $begin .= "\\clearpage";
+            }
             if ($begin !~ /^\s*$/) {
                 push @entries, ($begin,$ref);
             }
             if ($include) {
                 push @entries, read_file($self,
                                          "$my_dirname/$newfilename.tex");
-                $textline = $end;
+                if ($tag eq "include") {
+                    $textline = "\\clearpage".$end;
+                } else {
+                    $textline = $end;
+                }
             }
         }
         if (length($textline)) {