add support for 'to taste' specifier as recommended by peebus =u=
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Lynne Megido 2020-03-01 18:49:48 +10:00
parent f55dcebdb8
commit 65e22291ea
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
2 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ 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` 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 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.
- 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`.

View File

@ -5,6 +5,6 @@
<{{tag}}>Ingredients</{{tag}}>
<ul class='ingredients'>
{% for item in page.ingredients -%}
<li class='{% if item[3] %}optional{% endif %}'>{% if item[0][0] %}{{ item[0][0] }} to {{ item[0][1] }}{% else %}{{ item[0] }}{% endif %} {%- 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>