diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-01-19 18:10:31 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-01-19 18:10:31 +0100 |
| commit | 046d9c920ac2439d02a18517083449f0e99f9e9d (patch) | |
| tree | 252ee12222cf18e6ad9e50211e0b899df7007b2e /spgen.py | |
| parent | 7134160ada7a3e08d4c463bcc410043125a203c5 (diff) | |
| download | spgen-046d9c920ac2439d02a18517083449f0e99f9e9d.tar.gz spgen-046d9c920ac2439d02a18517083449f0e99f9e9d.zip | |
Diffstat (limited to 'spgen.py')
| -rwxr-xr-x | spgen.py | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -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(): |
