Compare commits

...

5 commits

Author SHA1 Message Date
65e22291ea
add support for 'to taste' specifier as recommended by peebus =u=
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-01 18:49:48 +10:00
f55dcebdb8
add support for 'x to y z of ingredient' format 2020-03-01 18:43:34 +10:00
08c6a2c18c
add support for optional ingredients 2020-03-01 18:38:27 +10:00
4b6d04ee6b
update homepage with better styling and more functionality 2020-03-01 18:25:15 +10:00
af61f630bd
some more css 2020-03-01 17:36:48 +10:00
6 changed files with 117 additions and 10 deletions

View file

@ -47,7 +47,11 @@ time: 240
```
- `name` (string) - The displayed name of the recipe. Does not appear in the URL.
- `author` (string, optional) - The author of the recipe.
- `ingredients` (list) - Each entry in `ingredients` consists of an amount, ingredient name, and unit terminology. `[2, flour, cups]` is displayed as `2 cups of flour`, while `[1, egg, null]` is displayed as `1 egg`. The third field is optional - `[1, egg, null]` is the same as `[1, egg]`.
- `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]`.
- 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".
- 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`.
- `method` (list) - A list of steps undertaken to create the recipe, written in plain English. Or whatever language you prefer.
- `time` (string, optional) - The time it takes to make the recipe in minutes.

View file

@ -3,8 +3,8 @@
{%- assign tag = "h4" -%}
{%- endif -%}
<{{tag}}>Ingredients</{{tag}}>
<ul>
<ul class='ingredients'>
{% for item in page.ingredients -%}
<li>{{ item[0] }} {%- if item[2] %} {{ item[2] }} of {% endif -%} {{ item[1] }}</li>
<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>
{% endfor -%}
</ul>

View file

@ -1,5 +1,18 @@
<ul>
<div id='recipes'>
{% for recipe in site.recipes -%}
<li><a href='{{ recipe.url }}'>{{ recipe.name }}</a></li>
<a href='{{ recipe.url }}' class='recipe-listing'>
<h2>{{ recipe.name }}</h2>
<p>
By {{ recipe.author }} - {{ recipe.method | size }} steps -
{%- if recipe.time > 59 %} {{ recipe.time | divided_by: 60}}h {% endif -%}
{% assign mins = recipe.time | modulo: 60 -%}
{%- if mins > 0 %}{{ mins }}m{% endif %}
</p>
<ol class='excerpt'>
{% for step in recipe.method | limit: 4 %}
<li>{{ step }}</li>
{% endfor %}
</ol>
</a>
{% endfor %}
</ul>
</div>

View file

@ -9,7 +9,7 @@
</head>
<body>
<div>
<div id='main'>
{{ content }}
</div>

View file

@ -2,4 +2,6 @@
title: Home
layout: default
---
<h1>Home</h1>
<p>Currently tracking {{ site.recipes.size }} recipes and {{ site.subrecipes.size }} subrecipes.</p>
{% include recipes.html %}

View file

@ -1,17 +1,53 @@
html {
overflow-y: scroll; /* force scrollbar to appear to stop elements jumping around when the scrollbar appears naturally */
}
body {
font-family: "DejaVu Sans", "Bitstream Vera Sans", "Helvetica", "Roboto", sans-serif;
display: flex;
flex-direction: column;
min-height: 100vh;
background: #fafafa;
margin: 0;
}
body div {
#main {
flex-grow: 1;
}
h1 {
margin: 0;
padding: 20px 0;
text-align: center;
background: linear-gradient(to right, turquoise, transparent 80%);
}
h2 {
padding-left: 10px;
background: linear-gradient(to right, turquoise 5px, transparent 5px 100%);
}
h1, h2, h3, h4, h5, h6 {
font-weight: 400;
}
h3 {
font-size: 1.3em;
}
h4 {
font-size: 1.2em;
margin: 0.75em 0;
}
.ingredients li.optional::before {
content: "(Optional) ";
font-style: italic;
}
.subrecipe {
background: #eee;
padding: 5px;
padding: 10px;
border-radius: 10px;
}
.subrecipe, p {
margin-left: 10px;
margin-right: 10px;
}
.subrecipe h3 {
margin: 0;
@ -33,6 +69,8 @@ body div {
}
.subrecipe-toggle::after {
font-style: italic;
font-size: 0.75em;
vertical-align: text-top;
}
.subrecipe .subrecipe-toggle::after {
content: "Show";
@ -41,6 +79,14 @@ body div {
content: "Hide";
}
a {
color: turquoise;
text-decoration: none;
}
a:not(.recipe-listing):hover {
text-decoration: underline;
}
ul {
list-style-type: "- ";
}
@ -49,9 +95,51 @@ ul, ol {
padding-left: 10px;
}
#recipes {
display: flex;
flex-flow: row wrap;
}
.recipe-listing {
display: block;
margin: 10px;
padding: 5px;
border-radius: 10px;
background: linear-gradient(to right, turquoise 5px, #eee 5px 100%);
max-width: 600px;
flex: 1 0 300px;
}
a.recipe-listing {
color: black;
}
.recipe-listing h2 {
background: none;
}
.excerpt {
color: grey;
position: relative;
margin-bottom: 0;
}
.excerpt::after {
top: 0;
left: 0;
right: 0;
bottom: 0;
content: "";
position: absolute;
font-size: 1em;
background: linear-gradient(to top, #eee 1em, transparent);
}
footer {
text-align: center;
margin: 20px auto;
background: #333;
display: block;
width: 100%;
padding: 20px 0;
margin: 0;
}
footer, .subtle {
color: grey;