Now with 100% more templating!
This commit is contained in:
parent
be587e755f
commit
036eb5a860
65
build.py
65
build.py
@ -1,39 +1,64 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import yaml
|
import yaml
|
||||||
|
import markdown
|
||||||
|
from jinja2 import Environment, PackageLoader, select_autoescape
|
||||||
|
env = Environment(
|
||||||
|
loader=PackageLoader("build"),
|
||||||
|
autoescape=select_autoescape()
|
||||||
|
)
|
||||||
|
menuOut = ''
|
||||||
|
recipesOut = ''
|
||||||
|
|
||||||
def writeLine(string):
|
def writeMenu(string):
|
||||||
global menuOut
|
global menuOut
|
||||||
menuOut += f"{string}\r\n"
|
menuOut += f"{string}\r\n"
|
||||||
|
|
||||||
|
def writeRec(string):
|
||||||
|
global recipesOut
|
||||||
|
recipesOut += f"{string}\r\n"
|
||||||
|
|
||||||
with open('menu.yaml', 'r') as file:
|
with open('menu.yaml', 'r') as file:
|
||||||
menu = yaml.safe_load(file)
|
menu = yaml.safe_load(file)
|
||||||
|
|
||||||
|
templateMenu = env.get_template("menu.html")
|
||||||
|
templateRecipes = env.get_template("recipes.html")
|
||||||
|
|
||||||
#print(menu['menu'])
|
with open('index.html', 'w') as file:
|
||||||
|
file.write(templateMenu.render(bevs = menu['menu']))
|
||||||
|
|
||||||
menuOut = '''\
|
with open('recipes.html', 'w') as file:
|
||||||
<html>
|
file.write(templateRecipes.render(bevs = menu['menu']))
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="style.css">
|
print(menu['menu'])
|
||||||
<title>Cocktail Menu</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
'''
|
|
||||||
|
|
||||||
for bev in menu['menu']:
|
for bev in menu['menu']:
|
||||||
#print(bev)
|
#print(bev)
|
||||||
for name in bev:
|
for name in bev:
|
||||||
print(name)
|
print(name)
|
||||||
writeLine(f'<h2>{name}</h2>')
|
writeMenu(f'<h2>{name}</h2>')
|
||||||
writeLine('<ul>')
|
writeRec(f'<h2>{name}</h2>')
|
||||||
|
writeMenu('<ul>')
|
||||||
|
writeRec('<ul>')
|
||||||
for ingredient in bev[name]['ingredients']:
|
for ingredient in bev[name]['ingredients']:
|
||||||
writeLine(f'<li>{ingredient}</li>')
|
writeMenu(f'<li>{list(ingredient)[0]}</li>')
|
||||||
writeLine('</ul>')
|
writeRec(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>')
|
||||||
|
writeMenu('</ul>')
|
||||||
|
writeRec('</ul>')
|
||||||
|
writeRec('<h3>Directions</h3>')
|
||||||
|
writeRec(markdown.markdown(bev[name]['directions']))
|
||||||
|
|
||||||
menuOut += '''\
|
for ingredient in menu['out_of_stock']:
|
||||||
</body>
|
print(ingredient)
|
||||||
</html>
|
|
||||||
'''
|
|
||||||
|
|
||||||
with open('index.html', 'w') as file:
|
|
||||||
file.write(menuOut)
|
|
||||||
|
testDict = {
|
||||||
|
'First item': {'nest': 'dict'},
|
||||||
|
'Second item': 'Bywe',
|
||||||
|
'Third item': 'Okay'
|
||||||
|
}
|
||||||
|
|
||||||
|
print(testDict)
|
||||||
|
|
||||||
|
for k, v in testDict.items():
|
||||||
|
print(f"{k}: {v}")
|
||||||
|
|||||||
201
index.html
201
index.html
@ -1,44 +1,173 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<title>Cocktail Menu</title>
|
<title>Cocktail Menu</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Old Fashioned</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Bourbon</li>
|
|
||||||
<li>Maple syrup</li>
|
<h2>Old Fashioned</h2>
|
||||||
<li>Angostura bitters</li>
|
<ul>
|
||||||
</ul>
|
|
||||||
<h2>Boulevardier</h2>
|
|
||||||
<ul>
|
<li>Bourbon</li>
|
||||||
<li>Bourbon</li>
|
|
||||||
<li>Campari</li>
|
|
||||||
<li>Sweet vermouth</li>
|
|
||||||
</ul>
|
<li>Maple syrup</li>
|
||||||
<h2>Sidecar</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Bourbon</li>
|
|
||||||
<li>Cointreau</li>
|
<li>Angostura bitters</li>
|
||||||
<li>Lemon juice</li>
|
|
||||||
</ul>
|
|
||||||
<h2>Gin & Tonic</h2>
|
</ul>
|
||||||
<ul>
|
|
||||||
<li>Gin</li>
|
|
||||||
<li>Tonic water</li>
|
|
||||||
</ul>
|
<h2>Boulevardier</h2>
|
||||||
<h2>Gimlet</h2>
|
<ul>
|
||||||
<ul>
|
|
||||||
<li>Gin</li>
|
|
||||||
<li>Lime juice</li>
|
<li>Bourbon</li>
|
||||||
<li>Simple syrup</li>
|
|
||||||
</ul>
|
|
||||||
<h2>Bennet</h2>
|
|
||||||
<ul>
|
<li>Campari</li>
|
||||||
<li>Gin</li>
|
|
||||||
<li>Lime juice</li>
|
|
||||||
<li>Simple syrup</li>
|
|
||||||
<li>Angostura bitters</li>
|
<li>Sweet vermouth</li>
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Black Manhattan</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>Rye whiskey</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Amaro</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Angostura bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Orange bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>MonteNegroni</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>Amaro Montenegro</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Sweet vermouth</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Angostura bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Sidecar</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>Bourbon</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Cointreau</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Lemon juice</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Gin & Tonic</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Tonic water</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Gimlet</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Lime juice</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Simple syrup</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Bennet</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Lime juice</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Simple syrup</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>Angostura bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
76
menu.yaml
76
menu.yaml
@ -4,44 +4,84 @@ menu:
|
|||||||
base: Bourbon
|
base: Bourbon
|
||||||
category: Ancestrals
|
category: Ancestrals
|
||||||
ingredients:
|
ingredients:
|
||||||
- Bourbon
|
- Bourbon: 2 oz
|
||||||
- Maple syrup
|
- Maple syrup: 1tsp
|
||||||
- Angostura bitters
|
- Angostura bitters: 2 dashes
|
||||||
|
directions: |
|
||||||
|
1. Stir with ice. Strain into rocks glass over large cube.
|
||||||
|
1. Garnish with orange twist.
|
||||||
- Boulevardier:
|
- Boulevardier:
|
||||||
base: Bourbon
|
base: Bourbon
|
||||||
category: Spirit-Forward
|
category: Spirit-Forward
|
||||||
ingredients:
|
ingredients:
|
||||||
- Bourbon
|
- Bourbon: 1.5 oz
|
||||||
- Campari
|
- Campari: 1 oz
|
||||||
- Sweet vermouth
|
- Sweet vermouth: 1 oz
|
||||||
|
directions: |
|
||||||
|
1. Stir with ice. Strain into rocks glass over large cube.
|
||||||
|
1. Garnish with orange twist.
|
||||||
|
- Black Manhattan:
|
||||||
|
base: Rye whiskey
|
||||||
|
category: Spirit-Forward
|
||||||
|
ingredients:
|
||||||
|
- 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.
|
||||||
|
- MonteNegroni:
|
||||||
|
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
|
||||||
|
directions: |
|
||||||
|
1. Stir with ice. Strain into rocks glass over large cube.
|
||||||
|
1. Garnish with orange twist.
|
||||||
- Sidecar:
|
- Sidecar:
|
||||||
base: Bourbon
|
base: Bourbon
|
||||||
category: Sours
|
category: Sours
|
||||||
ingredients:
|
ingredients:
|
||||||
- Bourbon
|
- Bourbon: 2 oz
|
||||||
- Cointreau
|
- Cointreau: 1 oz
|
||||||
- Lemon juice
|
- Lemon juice: 0.5 oz
|
||||||
|
directions: |
|
||||||
|
1. Shake with ice. Double strain into chilled coupe.
|
||||||
- "Gin & Tonic":
|
- "Gin & Tonic":
|
||||||
base: Gin
|
base: Gin
|
||||||
category: Highballs
|
category: Highballs
|
||||||
ingredients:
|
ingredients:
|
||||||
- Gin
|
- Gin: 2 oz
|
||||||
- Tonic water
|
- Tonic water: 4 oz
|
||||||
|
directions: |
|
||||||
|
1. Pour gin and tonic over ice in short glass.
|
||||||
|
1. Stir gently.
|
||||||
|
1. Garnish with lime wheel.
|
||||||
- Gimlet:
|
- Gimlet:
|
||||||
base: Gin
|
base: Gin
|
||||||
category: Sours
|
category: Sours
|
||||||
ingredients:
|
ingredients:
|
||||||
- Gin
|
- Gin: 2 oz
|
||||||
- Lime juice
|
- Lime juice: 1 oz
|
||||||
- Simple syrup
|
- Simple syrup: 0.5 oz
|
||||||
|
directions: |
|
||||||
|
1. Shake with ice.
|
||||||
|
1. Double strain into chilled coupe.
|
||||||
- Bennet:
|
- Bennet:
|
||||||
base: Gin
|
base: Gin
|
||||||
category: Sours
|
category: Sours
|
||||||
ingredients:
|
ingredients:
|
||||||
- Gin
|
- Gin: 2 oz
|
||||||
- Lime juice
|
- Lime juice: 1 oz
|
||||||
- Simple syrup
|
- Simple syrup: 0.5 oz
|
||||||
- Angostura bitters
|
- Angostura bitters: 1 dash
|
||||||
|
directions: |
|
||||||
|
1. Shake with ice.
|
||||||
|
1. Double strain into chilled coupe.
|
||||||
|
|
||||||
out_of_stock:
|
out_of_stock:
|
||||||
- Rye whiskey
|
- Rye whiskey
|
||||||
|
|||||||
205
recipes.html
Normal file
205
recipes.html
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<title>Cocktail Menu</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Old Fashioned</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 oz Bourbon</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1tsp Maple syrup</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 dashes Angostura bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Stir with ice. Strain into rocks glass over large cube.
|
||||||
|
1. Garnish with orange twist.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Boulevardier</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>1.5 oz Bourbon</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 oz Campari</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 oz Sweet vermouth</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Stir with ice. Strain into rocks glass over large cube.
|
||||||
|
1. Garnish with orange twist.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Black Manhattan</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 oz Rye whiskey</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 oz Amaro</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 dash Angostura bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 dash Orange bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Stir with ice. Strain into chilled coupe.
|
||||||
|
1. Garnish with orange twist.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>MonteNegroni</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 1/3 oz Amaro Montenegro</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>2/3 oz Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>2/3 oz Sweet vermouth</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 drops Angostura bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Stir with ice. Strain into rocks glass over large cube.
|
||||||
|
1. Garnish with orange twist.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Sidecar</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 oz Bourbon</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 oz Cointreau</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>0.5 oz Lemon juice</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Shake with ice. Double strain into chilled coupe.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Gin & Tonic</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 oz Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>4 oz Tonic water</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Pour gin and tonic over ice in short glass.
|
||||||
|
1. Stir gently.
|
||||||
|
1. Garnish with lime wheel.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Gimlet</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 oz Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 oz Lime juice</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>0.5 oz Simple syrup</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Shake with ice.
|
||||||
|
1. Double strain into chilled coupe.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Bennet</h2>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
<li>2 oz Gin</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 oz Lime juice</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>0.5 oz Simple syrup</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>1 dash Angostura bitters</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
1. Shake with ice.
|
||||||
|
1. Double strain into chilled coupe.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
11
templates/base.html
Normal file
11
templates/base.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<title>{% block title %}{% endblock %}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
16
templates/menu.html
Normal file
16
templates/menu.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}Cocktail Menu{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
{% for bev in bevs %}
|
||||||
|
{% for name, details in bev.items() %}
|
||||||
|
<h2>{{ name }}</h2>
|
||||||
|
<ul>
|
||||||
|
{% for ingredient in details['ingredients'] %}
|
||||||
|
{% for name, amount in ingredient.items() %}
|
||||||
|
<li>{{ name }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
18
templates/recipes.html
Normal file
18
templates/recipes.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}Cocktail Menu{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
{% for bev in bevs %}
|
||||||
|
{% for name, details in bev.items() %}
|
||||||
|
<h2>{{ name }}</h2>
|
||||||
|
<ul>
|
||||||
|
{% for ingredient in details['ingredients'] %}
|
||||||
|
{% for name, amount in ingredient.items() %}
|
||||||
|
<li>{{ amount }} {{ name }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
<h3>Directions!</h3>
|
||||||
|
{{ details['directions'] }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
Loading…
x
Reference in New Issue
Block a user