2020-02-29 18:05:06 +00:00
---
layout: default
---
2020-02-29 21:05:34 +00:00
{%- comment -%} return everything before the first full stop, without the trailing "_recipes/". for example: "_recipes/file.yml.md" becomes "file" {%- endcomment -%}
{%- assign id = page.path | split: "." | pop | first | remove_first: "_recipes/" -%}
2020-02-29 18:05:06 +00:00
{%- comment -%} unfortunately we have to iterate through the entire subrecipe folder twice - once to see if there are any subrecipes that apply here, and another time to put them in. thankfully we can break out of the first loop if we find a single match. i miss jinja ;u; {%- endcomment -%}
2020-02-29 18:07:36 +00:00
{%- assign applicable_subrecipes = false -%}
{%- for subrecipe in site.subrecipes -%}
{%- if subrecipe.parents contains id -%}
2020-02-29 18:05:06 +00:00
{%- comment -%} we found one! {%- endcomment -%}
2020-02-29 18:07:36 +00:00
{%- assign applicable_subrecipes = true -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
2020-02-29 18:05:06 +00:00
< h1 > {{ page.name }}< / h1 >
2020-02-29 21:28:40 +00:00
{%- if page.time -%}
{%- if page.time > 59 %}
{%- assign hours = page.time | divided_by: 60 -%}
{%- assign minutes = page.time | modulo: 60 -%}
{%- assign time = hours | append: " hour" -%}
{%- if hours > 1 %}{% assign time = time | append: "s" %}{% endif -%}
{%- if minutes > 0 -%}
{%- assign time = time | append: " " | append: minutes | append: " minute" -%}
{%- if minutes > 1 %}{% assign time = time | append: "s" %}{% endif -%}
{%- endif -%}
{%- else -%}
{%- assign time = page.time %}
{%- endif -%}
{%- endif -%}
< p class = 'subtle' > {{ page.method.size }} steps - Estimated cooking time: {{ time | default: "Not provided" }} {% if page.author %} - By {{ page.author }} {% endif %}< / p >
2020-02-29 18:07:36 +00:00
{%- if applicable_subrecipes %}
2020-02-29 18:05:06 +00:00
< h2 > Subrecipes < / h2 >
2020-02-29 18:07:36 +00:00
{% for subrecipe in site.subrecipes -%}
{%- if subrecipe.parents contains id -%}
2020-03-01 06:47:33 +00:00
{%- assign srid = "sr-" | append: subrecipe.name | downcase | url_encode -%}
< div class = 'subrecipe' id = '{{ srid }}' >
< div class = 'subrecipe-heading' > < h3 > {{ subrecipe.name }}< / h3 > < span class = 'subrecipe-toggle show' onclick = "subrecipe_toggle('{{ srid }}');" > < / span > < / div >
2020-02-29 19:01:50 +00:00
< div class = 'subrecipe-output' >
{{ subrecipe.output }}
< / div >
2020-02-29 18:17:34 +00:00
< / div >
2020-02-29 18:07:36 +00:00
{%- endif -%}
{%- endfor -%}
{%- endif -%}
2020-02-29 18:05:06 +00:00
2020-02-29 18:07:36 +00:00
{%- include ingredients.html -%}
2020-02-29 18:11:17 +00:00
{%- include method.html -%}