47 lines
1.3 KiB
Makefile
47 lines
1.3 KiB
Makefile
|
|
compile:
|
|
typst compile main.typ
|
|
|
|
watch:
|
|
typst watch main.typ
|
|
|
|
watch-bib:
|
|
#!/usr/bin/env zsh
|
|
BIB_URL="http://127.0.0.1:23119/better-bibtex/export?/library;id:1/collection;key:B7TICUAL/PPH.biblatex"
|
|
|
|
# Initial download and compile
|
|
curl -o references.bib "$BIB_URL"
|
|
typst compile main.typ
|
|
|
|
# Background process to watch URL for changes
|
|
(
|
|
while true; do
|
|
TEMP_FILE=$(mktemp)
|
|
curl -s -o "$TEMP_FILE" "$BIB_URL"
|
|
if ! cmp -s "$TEMP_FILE" references.bib; then
|
|
echo "Bibliography updated from URL"
|
|
mv "$TEMP_FILE" references.bib
|
|
typst compile main.typ
|
|
echo "Recompiled main.typ"
|
|
else
|
|
rm "$TEMP_FILE"
|
|
fi
|
|
sleep 10
|
|
done
|
|
) &
|
|
URL_WATCHER_PID=$!
|
|
|
|
# Trap to kill background process on exit
|
|
trap "kill $URL_WATCHER_PID 2>/dev/null; exit" INT TERM EXIT
|
|
|
|
# Watch local files for changes
|
|
fswatch -o main.typ tplib-clement.typ references.bib | while read num; do
|
|
typst compile main.typ
|
|
echo "Recompiled main.typ"
|
|
done
|
|
|
|
update-bib:
|
|
curl -o references.bib "http://127.0.0.1:23119/better-bibtex/export?/library;id:1/collection;key:B7TICUAL/PPH.bibtex"
|
|
typst compile main.typ
|
|
|