proper recursive finding of conversions

This commit is contained in:
Emi Vasilek 2023-11-14 13:36:49 +01:00
parent 5fd453759b
commit ffa0253193
4 changed files with 71 additions and 25 deletions

View file

@ -1,3 +1,6 @@
{% macro price(rec) -%}
{% if rec.price == None %}?{%else%}{{rec.price|round(1)|numprint}}{% endif %} CZK
{%- endmacro %}
<!DOCTYPE html>
<html lang="en">
<head>
@ -8,4 +11,4 @@
<body>
{% block body %}{% endblock %}
</body>
</html>
</html>

View file

@ -3,6 +3,6 @@
{%block body %}
<h1>Recipes</h1>
{% for recipe in recipes %}
<li><a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
<li>{{price(recipe)}} <a href="{{ recipe.outpath }}">{{ recipe.title }}</a></li>
{% endfor %}
{%endblock%}
{%endblock%}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% macro ingredientpart(ing) -%}
{% if ing.price != None %}{{ing.price|round(1)|numprint}}{%else%} ?{%endif%} {{ing.amount|amountprint}} {{ing["unit"].name}} {{ ing.name }}
{{price(ing)}} {{ing.amount|amountprint}} {{ing["unit"].name}} {{ ing.name }} {{ing.note}}
{%- endmacro %}
{% macro ingredient(ing) -%}
@ -22,6 +22,7 @@
{% for ing in rec.ingredients %}
<li>{{ingredient(ing)}}</li>
{% endfor %}
price: {{ price(rec) }}
{% endif %}
{% if rec.steps|length != 0 %}
<h3>Steps</h3>