From 03eb5780cafa7a85e24d39b99fd1926d880e4ced Mon Sep 17 00:00:00 2001 From: NotXia <35894453+NotXia@users.noreply.github.com> Date: Sun, 31 Dec 2023 10:05:23 +0100 Subject: [PATCH] Add no-update commit flag --- .gitignore | 4 +++- compile.sh | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index ed96c40..003bf85 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ *.aux *.toc *.out -[!_]*.pdf \ No newline at end of file +[!_]*.pdf + +.compiled \ No newline at end of file diff --git a/compile.sh b/compile.sh index f19805b..3e47099 100644 --- a/compile.sh +++ b/compile.sh @@ -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 "" + echo `LC_ALL="en_GB.UTF-8" git log -1 --grep="" --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