aboutsummaryrefslogtreecommitdiff
path: root/spgen.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-01-19 18:10:31 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2026-01-19 18:10:31 +0100
commit046d9c920ac2439d02a18517083449f0e99f9e9d (patch)
tree252ee12222cf18e6ad9e50211e0b899df7007b2e /spgen.py
parent7134160ada7a3e08d4c463bcc410043125a203c5 (diff)
downloadspgen-main.tar.gz
spgen-main.zip
add and support HTML templatesHEADmain
Diffstat (limited to 'spgen.py')
-rwxr-xr-xspgen.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/spgen.py b/spgen.py
index 42ddfed..a72f440 100755
--- a/spgen.py
+++ b/spgen.py
@@ -8,6 +8,10 @@ import sys
class SPTemplate(Template):
+ """Seating plan template
+
+ %% is used as delimiter because the most templates are written in LaTeX.
+ """
delimiter = '%%'
@@ -15,11 +19,22 @@ def print_sp_template(template: SPTemplate, duration: str, names: list[str],
seats: list[int]):
"""Print the template including our name definitions"""
defs = []
- for name in names:
- seat = seats.pop()
+ seating = {i: '' for i in range(1, 33)}
+ for i, name in enumerate(names):
+ seat = seats[i]
+ seating[seat] = name
defs.append(rf'\csdef{{name{seat}}}{{{name}}}')
+
defs.append(rf'\csdef{{duration}}{{{duration}}}')
- print(template.substitute({'defs': '\n'.join(defs)}))
+
+ subs = {
+ 'defs': '\n'.join(defs)
+ } | {
+ f'name{seat}': name
+ for seat, name in seating.items()
+ }
+
+ print(template.substitute(subs))
def main():