-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenslides.py
More file actions
47 lines (38 loc) · 1.06 KB
/
genslides.py
File metadata and controls
47 lines (38 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import subprocess
from pathlib import Path
from jinja2 import Environment
# Tuples with:
# - Author name
# - Talk title
# - PDF file name (or None if not available)
TALKS: list[tuple[str, str, str | None]] = [
# [...]
# --- wait list ---
# [...]
]
def main() -> None:
talks: list[tuple[str, str, str | None, str]] = [
(speaker, title, pdf, next_speaker)
for (speaker, title, pdf), (next_speaker, _, _)
in zip(TALKS, TALKS[1:] + [("", "", None)])
]
env = Environment(
variable_start_string="((",
variable_end_string="))",
block_start_string="((*",
block_end_string="*))",
comment_start_string="((=",
comment_end_string="=))",
autoescape=False,
)
j2_src = Path("genslides.tex.j2").read_text()
template = env.from_string(j2_src)
tex_src = template.render(entries=talks)
tex_path = Path("talks.tex")
tex_path.write_text(tex_src)
subprocess.run(
["latexmk", "-pdf", tex_path],
check=True,
)
if __name__ == "__main__":
main()