This commit is contained in:
Mark 2025-01-20 11:18:59 -08:00
parent 8182ce6a24
commit 8efc57cbeb
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 19 additions and 25 deletions

View File

@ -7,3 +7,7 @@ end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = false insert_final_newline = false
[*.yml]
indent_style = space
indent_size = 2

View File

@ -4,23 +4,19 @@
# (handout and solutions, if they exist), and creates # (handout and solutions, if they exist), and creates
# a zip of all resulting files. # a zip of all resulting files.
# Where we're running this script # Where we're running this script
run_dir=$(pwd) run_dir=$(pwd)
tectonic=$(pwd)/tectonic
# Output files # Output files
target_dir="${run_dir}/output" target_dir="${run_dir}/output"
target_zip="${run_dir}/output.zip" target_zip="${run_dir}/output.zip"
# Clean up previous build # Clean up previous build
rm -drf "${target_dir}" rm -drf "${target_dir}"
rm -f "${target_zip}" rm -f "${target_zip}"
# Build one document. # Build one document.
# Args: <target_dir> <job_name> <doc_dir> <main_file> # Args: <target_dir> <job_name> <doc_dir> <main_file>
# target_dir: move output pdf to this directory # target_dir: move output pdf to this directory
@ -38,12 +34,12 @@ function build() {
tectonic_args=( tectonic_args=(
--chatter minimal --chatter minimal
--web-bundle "https://static.betalupi.com/tectonic/texlive2023.tar" #--web-bundle "https://static.betalupi.com/tectonic/texlive2023.tar"
) )
# Build handout # Build handout
echo "\\def\\argNoSolutions{1}\\input{${main_file}}" | \ echo "\\def\\argNoSolutions{1}\\input{${main_file}}" |
tectonic \ "${tectonic}" \
"${tectonic_args[@]}" \ "${tectonic_args[@]}" \
--outfmt pdf \ --outfmt pdf \
- -
@ -60,10 +56,9 @@ function build() {
echo "" echo ""
fi fi
# Build solutions # Build solutions
echo "\\def\\argYesSolutions{1}\\input{${main_file}}" | \ echo "\\def\\argYesSolutions{1}\\input{${main_file}}" |
tectonic \ "${tectonic}" \
"${tectonic_args[@]}" \ "${tectonic_args[@]}" \
--outfmt pdf \ --outfmt pdf \
- -
@ -88,7 +83,6 @@ function build() {
echo "" echo ""
if [[ $handout_stat == 0 ]]; then if [[ $handout_stat == 0 ]]; then
( (
echo -n "{" echo -n "{"
@ -105,18 +99,15 @@ function build() {
echo -n "\"starred\": false" echo -n "\"starred\": false"
fi fi
echo -n "}," echo -n "},"
) >> "$target_dir/index.json" ) >>"$target_dir/index.json"
fi fi
cd "${run_dir}" cd "${run_dir}"
} }
mkdir -p "${target_dir}" mkdir -p "${target_dir}"
echo -n "[" > "$target_dir/index.json" echo -n "[" >"$target_dir/index.json"
for d in "${run_dir}/Misc/Warm-Ups"/*.tex; do
for d in "${run_dir}/Misc/Warm-Ups"/*.tex ; do
file="$(basename "${d}")" file="$(basename "${d}")"
build \ build \
"${target_dir}/Warm-Ups" \ "${target_dir}/Warm-Ups" \
@ -125,7 +116,7 @@ for d in "${run_dir}/Misc/Warm-Ups"/*.tex ; do
"${file}" "${file}"
done done
for d in "${run_dir}/Advanced"/*/ ; do for d in "${run_dir}/Advanced"/*/; do
doc_dir=$(realpath "${d}") doc_dir=$(realpath "${d}")
job_name="$(basename "${doc_dir}")" job_name="$(basename "${doc_dir}")"
@ -136,7 +127,7 @@ for d in "${run_dir}/Advanced"/*/ ; do
"main.tex" "main.tex"
done done
for d in "${run_dir}/Intermediate"/*/ ; do for d in "${run_dir}/Intermediate"/*/; do
doc_dir=$(realpath "${d}") doc_dir=$(realpath "${d}")
job_name="$(basename "${doc_dir}")" job_name="$(basename "${doc_dir}")"
@ -147,8 +138,7 @@ for d in "${run_dir}/Intermediate"/*/ ; do
"main.tex" "main.tex"
done done
echo -n "{}]" >> "$target_dir/index.json" echo -n "{}]" >>"$target_dir/index.json"
# cd so paths in zip are relative # cd so paths in zip are relative
cd "${target_dir}" cd "${target_dir}"