Compare commits

..

3 commits

Author SHA1 Message Date
7d11e7a57d
more gooder documentation
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-01 20:04:49 +10:00
1e5097e732
rewrite ingredients.html to be less confusing, minor layout fixes and css changes 2020-03-01 19:50:53 +10:00
77c15fa1b9
moved script/style to their own subdirs 2020-03-01 19:21:52 +10:00
6 changed files with 34 additions and 9 deletions

View file

@ -27,7 +27,7 @@ However, there won't be much to look at until you add some recipes!
## Recipe file format ## Recipe file format
Recipes are found in `_recipes/`, with subrecipes located in `_subrecipes/`. Recipes are found in `_recipes/`, with subrecipes located in `_subrecipes/`.
Here's an example recipe, which could be saved to `_recipes/chocolate_cake.yml`: Here's an example recipe, which could be saved to `_recipes/chocolate_cake.md`:
```yaml ```yaml
--- ---
name: Chocolate cake name: Chocolate cake
@ -48,7 +48,9 @@ time: 240
- `name` (string) - The displayed name of the recipe. Does not appear in the URL. - `name` (string) - The displayed name of the recipe. Does not appear in the URL.
- `author` (string, optional) - The author of the recipe. - `author` (string, optional) - The author of the recipe.
- `ingredients` (list) - Each entry in `ingredients` is an array consisting of up to four items: - `ingredients` (list) - Each entry in `ingredients` is an array consisting of up to four items:
- amount (number or array) - The amount of this item to add, e.g. `2` for 2 cups of flour. If this is `0`, the output will be e.g. "jalepeño chillis to taste" rather than "0 jalepeño chillis". If this in an array, it will be printed as `amount[0] to amount[1]`. For example, if you wanted to say "2 to 3 cups of peas", you would write `[[2, 3], peas, cups]`. - amount (number or array) - The amount of this item to add, e.g. `2` for 2 cups of flour.
- If this is `0`, the output will be e.g. "jalepeño chillis to taste" rather than "0 jalepeño chillis".
- If this in an array, it will be printed as `amount[0] to amount[1]`. For example, if you wanted to say "2 to 3 cups of peas", you would write `[[2, 3], peas, cups]`.
- ingredient name (string) - The name of the ingredient, e.g. `flour` for 2 cups of flour. - ingredient name (string) - The name of the ingredient, e.g. `flour` for 2 cups of flour.
- unit terminology (string, optional) - The unit that amount refers to, e.g. `cups` for 2 cups of flour. If left blank or null, as in `[1, egg]`, the output will simply be "1 egg". - unit terminology (string, optional) - The unit that amount refers to, e.g. `cups` for 2 cups of flour. If left blank or null, as in `[1, egg]`, the output will simply be "1 egg".
- optional (boolean, optional) - Whether or not this ingredient is optional. The ingredient `[1, chocolate egg, null, true]` produces "1 chocolate egg" and marks is as optional. Defaults to `false`. - optional (boolean, optional) - Whether or not this ingredient is optional. The ingredient `[1, chocolate egg, null, true]` produces "1 chocolate egg" and marks is as optional. Defaults to `false`.
@ -57,7 +59,7 @@ time: 240
The recipe's file name isn't important, but it's good practice to make it something obvious, like `chocolate_cake.md` and not `strawberry_pie.md`. The recipe's file name isn't important, but it's good practice to make it something obvious, like `chocolate_cake.md` and not `strawberry_pie.md`.
The recipe files are standard YAML. Every recipe **must** begin and end with three dashes [to ensure that Jekyll processes it](https://jekyllrb.com/docs/front-matter/). The recipe files are standard YAML. Every recipe **must** begin and end with three dashes [to ensure that Jekyll processes it](https://jekyllrb.com/docs/front-matter/). Jekyll only processes files with certain extensions. Even though the recipes are formatted as YAML, they can't be saved as `.yml` or `.yaml` files - they must be saved with an extension that Jekyll will process, like `.md` or `.html`.
Good: Good:
```yaml ```yaml

View file

@ -5,6 +5,20 @@
<{{tag}}>Ingredients</{{tag}}> <{{tag}}>Ingredients</{{tag}}>
<ul class='ingredients'> <ul class='ingredients'>
{% for item in page.ingredients -%} {% for item in page.ingredients -%}
<li class='{% if item[3] %}optional{% endif %}'>{% if item[0] != 0 %}{% if item[0][0] %}{{ item[0][0] }} to {{ item[0][1] }}{% else %}{{ item[0] }}{% endif %}{% endif %} {%- if item[2] %} {{ item[2] }} of {%- endif %} {{ item[1] }}{% if item[0] == 0 %} to taste{% endif %}</li> {%- assign tag = "li" -%}
{% endfor -%} {%- if item[3] -%}
{%- assign tag = tag | append: " class='optional'" -%}
{%- endif -%}
{%- assign amount = item[0] | append: " " -%}
{%- assign end = "" -%}
{%- if item[0][0] -%}
{%- assign amount = item[0][0] | append: " to " | append: item[0][1] | append: " " -%}
{%- elsif item[0] == 0 -%}
{%- assign amount = "" -%}
{%- assign end = " to taste" -%}
{%- endif -%}
<{{ tag }}>{{ amount }} {%- if item[2] %}{{ item[2] }} of {% endif -%} {{ item[1] }}{{ end }}</li>
{% endfor %}
</ul> </ul>

View file

@ -7,6 +7,6 @@
<ol> <ol>
{% for item in page.method -%} {% for item in page.method -%}
<li>{{ item }}</li> <li>{{ item }}</li>
{% endfor -%} {% endfor %}
</ol> </ol>
{%- endif -%} {%- endif -%}

View file

@ -3,8 +3,8 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel='stylesheet' href='/style.css'> <link rel='stylesheet' href='/assets/style.css'>
<script async src='/script.js'></script> <script async src='/assets/script.js'></script>
<title>{{ page.title }}</title> <title>{{ page.title }}</title>
</head> </head>
@ -13,7 +13,7 @@
{{ content }} {{ content }}
</div> </div>
{%- include footer.html -%} {% include footer.html -%}
</body> </body>

View file

@ -94,6 +94,9 @@ ul, ol {
list-style-position: inside; list-style-position: inside;
padding-left: 10px; padding-left: 10px;
} }
li {
padding: 1px 0;
}
#recipes { #recipes {
display: flex; display: flex;
@ -108,6 +111,12 @@ ul, ol {
background: linear-gradient(to right, turquoise 5px, #eee 5px 100%); background: linear-gradient(to right, turquoise 5px, #eee 5px 100%);
max-width: 600px; max-width: 600px;
flex: 1 0 300px; flex: 1 0 300px;
box-shadow: 0 0 3px #0003;
transition: 0.2s all;
}
.recipe-listing:hover {
box-shadow: 0 0 15px #0003;
} }
a.recipe-listing { a.recipe-listing {
color: black; color: black;