chore: add justfile

This commit is contained in:
2026-07-16 16:18:35 +02:00
parent a8c63d502e
commit 0a2b40d092

38
justfile Normal file
View File

@@ -0,0 +1,38 @@
# Local Variables:
# mode: makefile
# End:
set shell := ["bash", "-uc"]
outdir := "out"
report_out_path := outdir / "report.pdf"
summary_out_path := outdir / "summary.pdf"
default: all
_setup:
mkdir {{outdir}}
check-links document:
#!/usr/bin/env python3
import re
import requests
import sys
print("Checking links in {{document}}...")
with open("{{document}}", "rb") as f:
r = rb"</Type/Action/S/URI/URI\((.*?)\)"
matches = set(re.findall(r, f.read(), re.S))
print(f"Found {len(matches)} links")
for url in matches:
print(f"Testing {url.decode('utf-8')}")
res = requests.head(url, headers={"User-Agent": "BrokenURLChecker 1.0"})
if not (200 <= res.status_code <= 399):
print(f"{url} is broken: {res.status_code} {res.reason}")
sys.exit(1)
report: _setup
typst c --root . report/bachelor_thesis.typ {{report_out_path}}
summary: _setup
typst c --root . summary/exec_summary.typ {{summary_out_path}}
all: report summary