Directions now correctly converted from Markdown to HTML

This commit is contained in:
Justus Grunow 2025-01-25 22:16:21 -05:00
parent 6c163c11a7
commit 4c312cc3f7
3 changed files with 42 additions and 32 deletions

View File

@ -13,6 +13,15 @@ with open('menu.yaml', 'r') as file:
templateMenu = env.get_template("menu.html") templateMenu = env.get_template("menu.html")
templateRecipes = env.get_template("recipes.html") templateRecipes = env.get_template("recipes.html")
for bev in menu['menu']:
#print(bev)
for name in bev:
print(name)
for ingredient in bev[name]['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'])
with open('index.html', 'w') as file: with open('index.html', 'w') as file:
file.write(templateMenu.render(bevs = menu['menu'])) file.write(templateMenu.render(bevs = menu['menu']))
@ -21,13 +30,6 @@ with open('recipes.html', 'w') as file:
print(menu['menu']) print(menu['menu'])
for bev in menu['menu']:
#print(bev)
for name in bev:
print(name)
for ingredient in bev[name]['ingredients']:
print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>')
print(markdown.markdown(bev[name]['directions']))
for ingredient in menu['out_of_stock']: for ingredient in menu['out_of_stock']:
print(ingredient) print(ingredient)

View File

@ -26,9 +26,10 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Stir with ice. Strain into rocks glass over large cube. <p><ol>
1. Garnish with orange twist. <li>Stir with ice. Strain into rocks glass over large cube.</li>
</p> <li>Garnish with orange twist.</li>
</ol></p>
@ -51,9 +52,10 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Stir with ice. Strain into rocks glass over large cube. <p><ol>
1. Garnish with orange twist. <li>Stir with ice. Strain into rocks glass over large cube.</li>
</p> <li>Garnish with orange twist.</li>
</ol></p>
@ -80,9 +82,10 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Stir with ice. Strain into chilled coupe. <p><ol>
1. Garnish with orange twist. <li>Stir with ice. Strain into chilled coupe.</li>
</p> <li>Garnish with orange twist.</li>
</ol></p>
@ -109,9 +112,10 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Stir with ice. Strain into rocks glass over large cube. <p><ol>
1. Garnish with orange twist. <li>Stir with ice. Strain into rocks glass over large cube.</li>
</p> <li>Garnish with orange twist.</li>
</ol></p>
@ -134,8 +138,9 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Shake with ice. Double strain into chilled coupe. <p><ol>
</p> <li>Shake with ice. Double strain into chilled coupe.</li>
</ol></p>
@ -154,10 +159,11 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Pour gin and tonic over ice in short glass. <p><ol>
1. Stir gently. <li>Pour gin and tonic over ice in short glass.</li>
1. Garnish with lime wheel. <li>Stir gently.</li>
</p> <li>Garnish with lime wheel.</li>
</ol></p>
@ -180,9 +186,10 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Shake with ice. <p><ol>
1. Double strain into chilled coupe. <li>Shake with ice.</li>
</p> <li>Double strain into chilled coupe.</li>
</ol></p>
@ -209,9 +216,10 @@
</ul> </ul>
<h3>Directions</h3> <h3>Directions</h3>
<p>1. Shake with ice. <p><ol>
1. Double strain into chilled coupe. <li>Shake with ice.</li>
</p> <li>Double strain into chilled coupe.</li>
</ol></p>

View File

@ -2,5 +2,5 @@
{% block amount %}{{ amount }} {% endblock %} {% block amount %}{{ amount }} {% endblock %}
{% block directions %} {% block directions %}
<h3>Directions</h3> <h3>Directions</h3>
<p>{{ details['directions'] }}</p> <p>{{ details['directions_html']|safe }}</p>
{% endblock %} {% endblock %}