Add no-update commit flag

This commit is contained in:
2023-12-31 10:05:23 +01:00
parent 4b2f613e73
commit 03eb5780ca
2 changed files with 20 additions and 5 deletions

4
.gitignore vendored
View File

@ -5,4 +5,6 @@
*.aux
*.toc
*.out
[!_]*.pdf
[!_]*.pdf
.compiled

View File

@ -34,6 +34,12 @@ getDirCurrHash () {
echo `git log -n 1 --format='%h' $path/**/*.!(cls)`
}
getLastUpdateDate () {
# Get the last update date.
# Ignores .cls and commits containing "<noupdate>"
echo `LC_ALL="en_GB.UTF-8" git log -1 --grep="<noupdate>" --invert-grep --pretty="format:%ad" --date="format:%d %B %Y" ./**/*.!(cls)`
}
updateHashes () {
cd $work_dir
echo "ainotes.cls,`git log -n 1 --format='%h' ./ainotes.cls`" > $new_hash_file
@ -65,15 +71,22 @@ for f in **/[!_]*.tex; do
continue
fi
cd ${f_dir};
cd ${f_dir}
# Save copy of source .tex
cp main.tex main.bkp.tex
# Insert last update date
last_update=`LC_ALL="en_GB.UTF-8" git log -1 --pretty="format:%ad" --date="format:%d %B %Y" ./**/*.!(cls)`
cp --remove-destination $(readlink ainotes.cls) ainotes.cls
sed -i "s/PLACEHOLDER-LAST-UPDATE/${last_update}/" ainotes.cls
last_update=`getLastUpdateDate`
sed -i "s/PLACEHOLDER-LAST-UPDATE/${last_update}/" main.tex
# Compile
latexmk -pdf -jobname=${f_nameonly} ${f_base}
mv ${f_nameonly}.pdf $out_dir/${f_dir}/.
# Restore source
mv main.bkp.tex main.tex
cd $work_dir
done