* Scan for BibTeX files included by \bibliography.

* Automatically run BibTeX when necessary (i.e., when there are
  \citations in the aux file).

svn path=/nixpkgs/trunk/; revision=3222
This commit is contained in:
Eelco Dolstra 2005-06-20 15:20:37 +00:00
parent 6ce80304a5
commit fe0981babd
4 changed files with 12 additions and 5 deletions

View File

@ -15,8 +15,6 @@ for (my $n = 0; $n < @ARGV; $n += 2) {
my $fullPath = $ARGV[$n];
my $relPath = $ARGV[$n + 1];
print "$fullPath <- $relPath\n";
createDirs $relPath;
symlink $fullPath, $relPath or die "cannot create symlink `$relPath'";

View File

@ -33,6 +33,9 @@ rec {
args = [ ./find-includes.pl ];
rootFile = toString rootFile; # !!! hacky
# Forces rebuilds.
hack = __currentTime;
};
}

View File

@ -50,7 +50,13 @@ while (scalar @workset > 0) {
my $fn2 = $2;
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
push @workset, $path . "/" . $fn2 . ".cls";
}
} elsif (/\\bibliography\{(.*)\}/) {
foreach my $bib (split /,/, $1) {
$bib =~ s/^\s+//; # remove leading / trailing whitespace
$bib =~ s/\s+$//;
push @workset, $path . "/" . $bib . ".bib";
}
}
# !!! also support \usepackage
}

View File

@ -25,9 +25,9 @@ fi
$latex $rootName
if grep -q '\\bibitem' $rootNameBase.bbl; then
if grep -q '\\citation' $rootNameBase.aux; then
bibtex $rootNameBase
fi
fi
$latex $rootName