Simplified looping further by removing another unnessary array level

around 'ingredients' in YAML
This commit is contained in:
Justus Grunow 2025-01-26 10:49:43 -05:00
parent 378d0dc496
commit 6ff633e2f4
3 changed files with 34 additions and 36 deletions

View File

@ -18,8 +18,8 @@ print(menu)
for bev, details in menu['menu'].items():
#print(bev)
print(bev)
for ingredient in details['ingredients']:
print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>')
#for ingredient in details['ingredients']:
# print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>')
print(markdown.markdown(details['directions']))
details['directions_html'] = markdown.markdown(details['directions'])

View File

@ -4,9 +4,9 @@ menu:
base: Bourbon
category: Ancestrals
ingredients:
- Bourbon: 2 oz
- Maple syrup: 1tsp
- Angostura bitters: 2 dashes
Bourbon: 2 oz
Maple syrup: 1tsp
Angostura bitters: 2 dashes
directions: |
1. Stir with ice. Strain into rocks glass over large cube.
1. Garnish with orange twist.
@ -14,9 +14,9 @@ menu:
base: Bourbon
category: Spirit-Forward
ingredients:
- Bourbon: 1.5 oz
- Campari: 1 oz
- Sweet vermouth: 1 oz
Bourbon: 1.5 oz
Campari: 1 oz
Sweet vermouth: 1 oz
directions: |
1. Stir with ice. Strain into rocks glass over large cube.
1. Garnish with orange twist.
@ -24,9 +24,9 @@ menu:
base: Bourbon
category: Ancestrals
ingredients:
- Bourbon: 1.5 oz
- Sweet vermouth: 1 oz
- Angostura bitters: 2 dashes
Bourbon: 1.5 oz
Sweet vermouth: 1 oz
Angostura bitters: 2 dashes
directions: |
1. Stir with ice.
2. Strain into chilled coupe.
@ -35,10 +35,10 @@ menu:
base: Rye whiskey
category: Spirit-Forward
ingredients:
- Rye whiskey: 2 oz
- Amaro: 1 oz
- Angostura bitters: 1 dash
- Orange bitters: 1 dash
Rye whiskey: 2 oz
Amaro: 1 oz
Angostura bitters: 1 dash
Orange bitters: 1 dash
directions: |
1. Stir with ice. Strain into chilled coupe.
1. Garnish with orange twist.
@ -46,10 +46,10 @@ menu:
base: Amaro Montenegro & Gin
category:
ingredients:
- Amaro Montenegro: 1 1/3 oz
- Gin: 2/3 oz
- Sweet vermouth: 2/3 oz
- Angostura bitters: 2 drops
Amaro Montenegro: 1 1/3 oz
Gin: 2/3 oz
Sweet vermouth: 2/3 oz
Angostura bitters: 2 drops
directions: |
1. Stir with ice. Strain into rocks glass over large cube.
1. Garnish with orange twist.
@ -57,17 +57,17 @@ menu:
base: Bourbon
category: Sours
ingredients:
- Bourbon: 2 oz
- Cointreau: 1 oz
- Lemon juice: 0.5 oz
Bourbon: 2 oz
Cointreau: 1 oz
Lemon juice: 0.5 oz
directions: |
1. Shake with ice. Double strain into chilled coupe.
"Gin & Tonic":
base: Gin
category: Highballs
ingredients:
- Gin: 2 oz
- Tonic water: 4 oz
Gin: 2 oz
Tonic water: 4 oz
directions: |
1. Pour gin and tonic over ice in short glass.
1. Stir gently.
@ -76,9 +76,9 @@ menu:
base: Gin
category: Sours
ingredients:
- Gin: 2 oz
- Lime juice: 1 oz
- Simple syrup: 0.5 oz
Gin: 2 oz
Lime juice: 1 oz
Simple syrup: 0.5 oz
directions: |
1. Shake with ice.
1. Double strain into chilled coupe.
@ -86,10 +86,10 @@ menu:
base: Gin
category: Sours
ingredients:
- Gin: 2 oz
- Lime juice: 1 oz
- Simple syrup: 0.5 oz
- Angostura bitters: 1 dash
Gin: 2 oz
Lime juice: 1 oz
Simple syrup: 0.5 oz
Angostura bitters: 1 dash
directions: |
1. Shake with ice.
1. Double strain into chilled coupe.
@ -97,8 +97,8 @@ menu:
base: Campari
category: Highballs
ingredients:
- Campari: 1.5 oz
- Orange juice: 4.5 oz
Campari: 1.5 oz
Orange juice: 4.5 oz
directions: |
1. Blend orange juice and Campari until frothy.
1. Strain into ice-filled highball.

View File

@ -6,11 +6,9 @@
{% for name, details in bevs.items() %}
<h2>{{ name }}</h2>
<ul>
{% for ingredient in details['ingredients'] %}
{% for name, amount in ingredient.items() %}
{% for name, amount in details['ingredients'].items() %}
<li>{% block amount scoped %}{% endblock %}{{ name }}</li>
{% endfor %}
{% endfor %}
</ul>
{% block directions scoped %}{% endblock %}
{% endfor %}