diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-09-30 19:32:31 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-09-30 19:32:31 +0200 |
commit | 7a0003aff5262172700c5a10c53d91fa4421eec4 (patch) | |
tree | 5bfddd4e5a349fc0fbed05ac805287b6767b789e /common/scripts/latex/build.sh | |
parent | chore(version): v0.7.3 (diff) | |
download | flake-templates-7a0003aff5262172700c5a10c53d91fa4421eec4.tar.gz flake-templates-7a0003aff5262172700c5a10c53d91fa4421eec4.zip |
fix(templates/latex/{academia,letter}): Share files and update to lpm v2.0
Diffstat (limited to 'common/scripts/latex/build.sh')
-rwxr-xr-x | common/scripts/latex/build.sh | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/common/scripts/latex/build.sh b/common/scripts/latex/build.sh index 1206ee7..c67ad52 100755 --- a/common/scripts/latex/build.sh +++ b/common/scripts/latex/build.sh @@ -1,14 +1,30 @@ #!/usr/bin/env sh -# if no parameter is given, use 'dst' as destination directory -if [ -z "$1" ]; then - dst=build -else - dst="$1" -fi +file="./%INIT_APPLICATION_NAME.tex" +dst=build + +clear=false + +for arg in "$@"; do + case "$arg" in + "--clear") + clear=true + ;; + --*) + echo "No such option: '$arg'" + exit 2 + ;; + *) + file="$arg" + ;; + esac +done # find all directories which are not the destination dir or inside it find . -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do mkdir --parents "$dst/$dir" done -latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "./%INIT_APPLICATION_NAME.tex" + +test "$clear" = true && rm "$dst/${file%tex}out" + +latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file" |