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(): for bev, details in menu['menu'].items():
#print(bev) #print(bev)
print(bev) print(bev)
for ingredient in details['ingredients']: #for ingredient in details['ingredients']:
print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>') # print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>')
print(markdown.markdown(details['directions'])) print(markdown.markdown(details['directions']))
details['directions_html'] = markdown.markdown(details['directions']) details['directions_html'] = markdown.markdown(details['directions'])

View File

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

View File

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