recipe-site/_includes/ingredients.html

26 lines
835 B
HTML

{%- assign tag = "h2" -%}
{%- if page.collection == "subrecipes" -%}
{%- assign tag = "h4" -%}
{%- endif -%}
<{{tag}}>Ingredients</{{tag}}>
<ul class='ingredients'>
{% for item in page.ingredients -%}
{%- assign tag = "li" -%}
{%- if item[3] -%}
{%- assign tag = tag | append: " class='optional'" -%}
{%- endif -%}
{%- assign end = "" -%}
{%- if item[0][0] -%}
{%- assign to = item[0][1] | fractionalise: 10 -%}
{%- assign amount = item[0][0] | fractionalise: 10 | append: " to " | append: to | append: " " -%}
{%- elsif item[0] == 0 -%}
{%- assign amount = "" -%}
{%- assign end = " to taste" -%}
{%- else -%}
{%- assign amount = item[0] | fractionalise: 10 | append: " " -%}
{%- endif -%}
<{{ tag }}>{{ amount }} {%- if item[2] %}{{ item[2] }} of {% endif -%} {{ item[1] }}{{ end }}</li>
{% endfor %}
</ul>