comfy-recipes/comfyrecipes/templates/recipe.html

55 lines
1.5 KiB
HTML

{% extends "base.html" %}
{% macro ingredientpart(ing) -%}
{% if ing.price != None %}{{price(ing.price)}} {%endif%}
{% if ing.amount != None %} {{ing.amount|amountprint}}
{% if ing.unit != None %} {{ing.unit.name}}{% endif %}
{%endif%}
{{ ing.name }}
{% if ing.note != "" %} {{ing.note}}{% endif %}
{%- endmacro %}
{% macro ingredient(ing) -%}
{{ingredientpart(ing)}}
{% if ing.alternatives|length != 0 %}
{% for alting in ing.alternatives %}
or {{ingredientpart(alting)}}
{% endfor %}
{% endif %}
{%- endmacro %}
{% macro getrecipe(rec) -%}
{% for subrecipe in rec.subrecipes %}
{{getrecipe(subrecipe)}}
{% endfor %}
<h1>{{rec.title}}</h1>
{% if rec.description != None %}<p>{{rec.description.html|safe}}</p>{%endif%}
{% if rec.source != None %}source: {{rec.source.html|safe}}{%endif%}
{% if rec.ingredients|length != 0 %}
<h3>Ingredients</h3>
{% for ing in rec.ingredients %}
<li>{{ingredient(ing)}}</li>
{% endfor %}
{% if rec.price != None %}
<br>
price: {{multiprice(rec.price)}}
{%endif%}
{% endif %}
{% if rec.stepsections|length != 0 %}
<h3>Steps</h3>
{% for stepsection in rec.stepsections %}
{% if stepsection.title != "default" %}
<h4>{{stepsection.title}}</h4>
{% endif %}
{% for step in stepsection.steps %}
<li>{{ step }}</li>
{% endfor %}
{% endfor %}
{% endif %}
<hr>
{%- endmacro %}
{%block title%}{{recipe.title}}{%endblock%}
{%block body %}
<a href="index.html">back</a>
{{getrecipe(recipe)}}
{%endblock%}