From be587e755fdda54f0776e980c494324ff7d62d47 Mon Sep 17 00:00:00 2001 From: Justus Grunow Date: Thu, 23 Jan 2025 21:47:49 -0500 Subject: [PATCH] Writing generator in python. MVP working --- build.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 build.py diff --git a/build.py b/build.py new file mode 100755 index 0000000..8ea1fe2 --- /dev/null +++ b/build.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +import yaml + +def writeLine(string): + global menuOut + menuOut += f"{string}\r\n" + +with open('menu.yaml', 'r') as file: + menu = yaml.safe_load(file) + + +#print(menu['menu']) + +menuOut = '''\ + + + +Cocktail Menu + + +''' + +for bev in menu['menu']: + #print(bev) + for name in bev: + print(name) + writeLine(f'

{name}

') + writeLine('') + +menuOut += '''\ + + +''' + +with open('index.html', 'w') as file: + file.write(menuOut)