Files
2026-08-19 15:34:21 +02:00

51 lines
1.5 KiB
Makefile

# Local Variables:
# mode: makefile
# End:
set shell := ["bash", "-uc"]
outdir := "out"
report_out_path := outdir / "report.pdf"
summary_out_path := outdir / "summary.pdf"
poster_out_path := outdir / "poster.pdf"
presentation_out_path := outdir / "presentation.pdf"
presentation_pdfpc_path := outdir / "presentation.pdfpc"
default: all
_setup:
mkdir -p {{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}}
poster: _setup
typst c --root . poster/poster.typ {{poster_out_path}}
presentation: _setup
typst c --root . presentation/presentation.typ {{presentation_out_path}}
typst eval --root . 'query(<pdfpc-file>).first().value' --in presentation/presentation.typ > {{presentation_pdfpc_path}}
present: presentation
pympress {{presentation_out_path}}
all: report summary poster presentation