diff options
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(): |
