51 lines
2.3 KiB
HTML
51 lines
2.3 KiB
HTML
---
|
|
layout: default
|
|
custom_h1: true
|
|
---
|
|
{%- 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/" -%}
|
|
{%- 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 -%}
|
|
{%- assign applicable_subrecipes = false -%}
|
|
{%- for subrecipe in site.subrecipes -%}
|
|
{%- if subrecipe.parents contains id -%}
|
|
{%- comment -%} we found one! {%- endcomment -%}
|
|
{%- assign applicable_subrecipes = true -%}
|
|
{%- break -%}
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
|
|
<h1 class='scrolling'>{{ page.name }}</h1>
|
|
<h1 class='invisible'>{{ page.name }}</h1>
|
|
{%- 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'>{% if page.difficulty %}Difficulty: {% include difficulty_stars.html %} - {% endif %}{{ page.method.size }} steps - Estimated cooking time: {{ time | default: "Not provided" }} {% if page.author %} - By {{ page.author }} {% endif %}</p>
|
|
{%- if applicable_subrecipes %}
|
|
<h2> Subrecipes </h2>
|
|
{% for subrecipe in site.subrecipes -%}
|
|
{%- if subrecipe.parents contains id -%}
|
|
{%- 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>
|
|
<div class='subrecipe-output'>
|
|
{{ subrecipe.output }}
|
|
</div>
|
|
</div>
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
{%- endif -%}
|
|
|
|
{%- include ingredients.html -%}
|
|
{%- include method.html -%}
|