Greatly simplified the looping logic by removing an unnessary array
level from the menu YAML
This commit is contained in:
parent
80190a3669
commit
22f7f6908c
16
build.py
16
build.py
@ -13,14 +13,15 @@ with open('menu.yaml', 'r') as file:
|
||||
templateMenu = env.get_template("menu.html")
|
||||
templateRecipes = env.get_template("recipes.html")
|
||||
|
||||
for bev in menu['menu']:
|
||||
print(menu)
|
||||
|
||||
for bev, details in menu['menu'].items():
|
||||
#print(bev)
|
||||
for name in bev:
|
||||
print(name)
|
||||
for ingredient in bev[name]['ingredients']:
|
||||
print(bev)
|
||||
for ingredient in details['ingredients']:
|
||||
print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>')
|
||||
print(markdown.markdown(bev[name]['directions']))
|
||||
bev[name]['directions_html'] = markdown.markdown(bev[name]['directions'])
|
||||
print(markdown.markdown(details['directions']))
|
||||
details['directions_html'] = markdown.markdown(details['directions'])
|
||||
|
||||
with open('index.html', 'w') as file:
|
||||
file.write(templateMenu.render(bevs = menu['menu']))
|
||||
@ -28,8 +29,5 @@ with open('index.html', 'w') as file:
|
||||
with open('recipes.html', 'w') as file:
|
||||
file.write(templateRecipes.render(bevs = menu['menu']))
|
||||
|
||||
print(menu['menu'])
|
||||
|
||||
|
||||
for ingredient in menu['out_of_stock']:
|
||||
print(ingredient)
|
||||
|
||||
16
menu.yaml
16
menu.yaml
@ -1,6 +1,6 @@
|
||||
---
|
||||
menu:
|
||||
- Old Fashioned:
|
||||
Old Fashioned:
|
||||
base: Bourbon
|
||||
category: Ancestrals
|
||||
ingredients:
|
||||
@ -10,7 +10,7 @@ menu:
|
||||
directions: |
|
||||
1. Stir with ice. Strain into rocks glass over large cube.
|
||||
1. Garnish with orange twist.
|
||||
- Boulevardier:
|
||||
Boulevardier:
|
||||
base: Bourbon
|
||||
category: Spirit-Forward
|
||||
ingredients:
|
||||
@ -20,7 +20,7 @@ menu:
|
||||
directions: |
|
||||
1. Stir with ice. Strain into rocks glass over large cube.
|
||||
1. Garnish with orange twist.
|
||||
- Black Manhattan:
|
||||
Black Manhattan:
|
||||
base: Rye whiskey
|
||||
category: Spirit-Forward
|
||||
ingredients:
|
||||
@ -31,7 +31,7 @@ menu:
|
||||
directions: |
|
||||
1. Stir with ice. Strain into chilled coupe.
|
||||
1. Garnish with orange twist.
|
||||
- MonteNegroni:
|
||||
MonteNegroni:
|
||||
base: Amaro Montenegro & Gin
|
||||
category:
|
||||
ingredients:
|
||||
@ -42,7 +42,7 @@ menu:
|
||||
directions: |
|
||||
1. Stir with ice. Strain into rocks glass over large cube.
|
||||
1. Garnish with orange twist.
|
||||
- Sidecar:
|
||||
Sidecar:
|
||||
base: Bourbon
|
||||
category: Sours
|
||||
ingredients:
|
||||
@ -51,7 +51,7 @@ menu:
|
||||
- Lemon juice: 0.5 oz
|
||||
directions: |
|
||||
1. Shake with ice. Double strain into chilled coupe.
|
||||
- "Gin & Tonic":
|
||||
"Gin & Tonic":
|
||||
base: Gin
|
||||
category: Highballs
|
||||
ingredients:
|
||||
@ -61,7 +61,7 @@ menu:
|
||||
1. Pour gin and tonic over ice in short glass.
|
||||
1. Stir gently.
|
||||
1. Garnish with lime wheel.
|
||||
- Gimlet:
|
||||
Gimlet:
|
||||
base: Gin
|
||||
category: Sours
|
||||
ingredients:
|
||||
@ -71,7 +71,7 @@ menu:
|
||||
directions: |
|
||||
1. Shake with ice.
|
||||
1. Double strain into chilled coupe.
|
||||
- Bennet:
|
||||
Bennet:
|
||||
base: Gin
|
||||
category: Sours
|
||||
ingredients:
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
{% block bodyclass %}menu{% endblock %}
|
||||
{% block content %}
|
||||
<h1>{% block header %}Cocktails{% endblock %}</h1>
|
||||
{% for bev in bevs %}
|
||||
{% for name, details in bev.items() %}
|
||||
{% for name, details in bevs.items() %}
|
||||
<h2>{{ name }}</h2>
|
||||
<ul>
|
||||
{% for ingredient in details['ingredients'] %}
|
||||
@ -15,5 +14,4 @@
|
||||
</ul>
|
||||
{% block directions scoped %}{% endblock %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user