Browse Source

Two fixes to the handling of the --bbl option

1. Remove "old/" and "new/" prefixes from the --expand-bbl argument to
latexpand.  Not wanted since we have already changed to the relevant
directory.

2. Allow for the case where the .bbl files are not stored in the repo.
Try to regenerate them on the fly if they are missing.

(Whitespace fixes by Matthieu Moy)
master
William Henney 11 years ago
committed by Matthieu Moy
parent
commit
f09fc140e1
  1. 34
      git-latexdiff

34
git-latexdiff

@ -459,24 +459,46 @@ fi
# Shortcut to include bbl # Shortcut to include bbl
if test "$bbl" = 1; then if test "$bbl" = 1; then
oldbbl=("--expand-bbl old/"$mainbase".bbl")
newbbl=("--expand-bbl new/"$mainbase".bbl")
bblexpand=("--expand-bbl "$mainbase".bbl")
else else
oldbbl=("")
newbbl=("")
bblexpand=("")
fi fi
# Create flattened documents and keep for debugging # Create flattened documents and keep for debugging
if test "$flatten" = 1; then if test "$flatten" = 1; then
if [ "$bbl" = 1 ]; then
if [ ! -f "old/"$maindir$mainbase".bbl" ]; then
verbose "Attempting to regenerate missing old/"$maindir$mainbase".bbl"
(
cd old/"$maindir"
log_cmd pdflatex0.log pdflatex $latexopt "$mainbase" || compile_error=1
log_cmd bibtex0.log bibtex "$mainbase" || compile_error=1
)
if [ "$compile_error" = 1 ]; then
die "Failed to regenerate .bbl for old version"
fi
fi
if [ ! -f "new/"$maindir$mainbase".bbl" ]; then
verbose "Attempting to regenerate missing new/"$maindir$mainbase".bbl"
(
cd new/"$maindir"
log_cmd pdflatex0.log pdflatex $latexopt "$mainbase" || compile_error=1
log_cmd bibtex0.log bibtex "$mainbase" || compile_error=1
)
if [ "$compile_error" = 1 ]; then
die "Failed to regenerate .bbl for new version"
fi
fi
fi
verbose "Running latexpand" verbose "Running latexpand"
( (
cd old/"$maindir" && cd old/"$maindir" &&
latexpand "$mainbase".tex "${latexpand[@]}" $oldbbl
latexpand "$mainbase".tex "${latexpand[@]}" $bblexpand
) > old-"$mainbase"-fl.tex \ ) > old-"$mainbase"-fl.tex \
|| die "latexpand failed for old version" || die "latexpand failed for old version"
( (
cd new/"$maindir" && cd new/"$maindir" &&
latexpand "$mainbase".tex "${latexpand[@]}" $newbbl
latexpand "$mainbase".tex "${latexpand[@]}" $bblexpand
) > new-"$mainbase"-fl.tex \ ) > new-"$mainbase"-fl.tex \
|| die "latexpand failed for new version" || die "latexpand failed for new version"
verbose_done verbose_done

Loading…
Cancel
Save