* Support \pgfimage.

svn path=/nixpkgs/trunk/; revision=7087
This commit is contained in:
Eelco Dolstra 2006-11-22 07:06:10 +00:00
parent 244a91a090
commit 9485d4a320

View File

@ -17,6 +17,13 @@ $path =~ s/\/$//;
my @workset = (); my @workset = ();
my %doneset = (); my %doneset = ();
sub addToWorkSetExts {
my $base = shift;
foreach my $ext (@_) {
push @workset, "$base$ext";
}
}
push @workset, $root; push @workset, $root;
while (scalar @workset > 0) { while (scalar @workset > 0) {
@ -45,37 +52,37 @@ while (scalar @workset > 0) {
if (/\\input\{(.*)\}/) { if (/\\input\{(.*)\}/) {
my $fn2 = $1; my $fn2 = $1;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
push @workset, $path . "/" . $fn2; push @workset, "$path/$fn2";
} elsif (/\\usepackage(\[.*\])?\{(.*)\}/) { } elsif (/\\usepackage(\[.*\])?\{(.*)\}/) {
my $fn2 = $2; my $fn2 = $2;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
push @workset, $path . "/" . $fn2 . ".sty"; push @workset, "$path/$fn2.sty";
} elsif (/\\documentclass(\[.*\])?\{(.*)\}/) { } elsif (/\\documentclass(\[.*\])?\{(.*)\}/) {
my $fn2 = $2; my $fn2 = $2;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
push @workset, $path . "/" . $fn2 . ".cls"; push @workset, "$path/$fn2.cls";
} elsif (/\\bibliographystyle\{(.*)\}/) { } elsif (/\\bibliographystyle\{(.*)\}/) {
my $fn2 = $1; my $fn2 = $1;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
push @workset, $path . "/" . $fn2 . ".bst"; push @workset, "$path/$fn2.bst";
} elsif (/\\bibliography\{(.*)\}/) { } elsif (/\\bibliography\{(.*)\}/) {
foreach my $bib (split /,/, $1) { foreach my $bib (split /,/, $1) {
$bib =~ s/^\s+//; # remove leading / trailing whitespace $bib =~ s/^\s+//; # remove leading / trailing whitespace
$bib =~ s/\s+$//; $bib =~ s/\s+$//;
push @workset, $path . "/" . $bib . ".bib"; push @workset, "$path/$bib.bib";
} }
} elsif (/\\includegraphics(\[.*\])?\{(.*)\}/) { } elsif (/\\includegraphics(\[.*\])?\{(.*)\}/) {
my $fn2 = $2; my $fn2 = $2;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
push @workset, $path . "/" . $fn2 . ".pdf"; addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".ps");
push @workset, $path . "/" . $fn2 . ".png";
push @workset, $path . "/" . $fn2 . ".ps";
} elsif (/\\pgfdeclareimage(\[.*\])?\{.*\}\{(.*)\}/) { } elsif (/\\pgfdeclareimage(\[.*\])?\{.*\}\{(.*)\}/) {
my $fn2 = $2; my $fn2 = $2;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
push @workset, $path . "/" . $fn2 . ".pdf"; addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".jpg");
push @workset, $path . "/" . $fn2 . ".png"; } elsif (/\\pgfimage(\[.*\])?\{(.*)\}/) {
push @workset, $path . "/" . $fn2 . ".jpg"; my $fn2 = $2;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".jpg");
} }
# !!! also support \usepackage # !!! also support \usepackage
} }