[Po4a-commits] po4a/lib/Locale/Po4a TeX.pm,1.29,1.30
Nicolas FRAN??OIS
po4a-devel@lists.alioth.debian.org
Sun, 20 Feb 2005 19:35:55 +0000
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv31965/lib/Locale/Po4a
Modified Files:
TeX.pm
Log Message:
Use the TEXINPUTS environment variable to search for included files.
Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- TeX.pm 19 Feb 2005 22:04:34 -0000 1.29
+++ TeX.pm 20 Feb 2005 19:35:51 -0000 1.30
@@ -207,8 +207,6 @@
# See read_file.
our @exclude_include;
-# TODO: define the directory were files have to be searched for (TEXINPUTS?).
-
#########################
#### DEBUGGING STUFF ####
#########################
@@ -679,7 +677,9 @@
=item read_file
-Recursively read a file, appending included files.
+Recursively read a file, appending included files which are not listed in the
+@exclude_include array. Included files are searched in the directory of the
+input document or in a directory listed in the TEXINPUTS environment variable.
Except from the file inclusion part, it is a cut and paste from
Transtractor's read.
@@ -719,8 +719,15 @@
push @entries, ($begin,$ref);
}
if ($include) {
+ # search the file
+ foreach (($my_dirname, split(/:/, $ENV{"TEXINPUTS"}))) {
+ if (-r "$_/$newfilename.tex") {
+ $newfilename = "$_/$newfilename.tex";
+ last;
+ }
+ }
push @entries, read_file($self,
- "$my_dirname/$newfilename.tex");
+ $newfilename);
if ($tag eq "include") {
$textline = "\\clearpage".$end;
} else {
@@ -767,7 +774,14 @@
sub parse_definition_file {
my ($self,$filename)=@_;
- open (IN,"<$my_dirname/$filename")
+ foreach (($my_dirname, split(/:/, $ENV{"TEXINPUTS"}))) {
+ if (-r $_."/".$filename) {
+ $filename = $_."/".$filename;
+ last;
+ }
+ }
+
+ open (IN,"<$filename")
|| die wrap_mod("po4a::tex",
dgettext("po4a", "Can't open %s: %s"), $filename, $!);
while (<IN>) {