This commit is contained in:
gamerdonkey 2025-09-15 05:18:02 +00:00
vanhempi ba139706bb
commit a3e8e89160

Näytä tiedosto

@ -19,12 +19,9 @@ library](https://anytree.readthedocs.io/en/latest/).
### `create_recipe_json.py` ### `create_recipe_json.py`
This is a fairly naive script that walks you through the process of turning a This is a fairly naive script that walks you through the process of turning a
recipe into a tree structure. It has you list out ingredients, and then add recipe into a tree structure. You add ingredients and then add tasks to perform
tasks to perform on those ingredients. on the ingredients. The results of those tasks can have further tasks applied
to them, until you finally end up with your finished product.
You can add ingredients and then add tasks to perform on those ingredients.
The results of those tasks can have more tasks applied to them, until you end
up with your finished product.
The tree you build has a structure like this, with the last step at the root: The tree you build has a structure like this, with the last step at the root:
@ -46,14 +43,14 @@ shake and grill for 20 more mins
Leaves are raw ingredients, other nodes are tasks. A recipe can have multiple Leaves are raw ingredients, other nodes are tasks. A recipe can have multiple
tree roots. Once you are done adding ingredients and tasks, all trees are tree roots. Once you are done adding ingredients and tasks, all trees are
output to a JSON file based on the name you give to the recipe. written to a JSON file based on the name you give to the recipe.
### `recipes2html.py` ### `recipes2html.py`
***WARNING: These scripts do not sanitize most inputs!*** Parts of the JSON can ***WARNING: These scripts do not sanitize most inputs!*** Fields parsed from
have HTML which will be rendered out in the browser, which was very convenient the JSON can have HTML which will be rendered in the browser. This was very
for me but a terrible idea for security. **DO NOT RUN THIS CODE ON JSON YOU convenient for me but a terrible idea for security. **DO NOT RUN THIS CODE ON
DID NOT CREATE YOURSELF!** JSON YOU DID NOT CREATE YOURSELF!**
This script takes an argument pointing to a directory of recipe JSON files, in This script takes an argument pointing to a directory of recipe JSON files, in
the format created by the `create_recipe_json.py` script. It then does a the format created by the `create_recipe_json.py` script. It then does a
@ -67,8 +64,7 @@ file will be inserted into the header section of the generated `index.html`.
- A single node cannot have multiple tasks done on it (nerdy reason: because a - A single node cannot have multiple tasks done on it (nerdy reason: because a
node cannot have two parents). So this cannot perfectly represent, for example, node cannot have two parents). So this cannot perfectly represent, for example,
mixing cinnamon and sugar, then splitting that mixture up and doing separate mixing cinnamon and sugar, then splitting that mixture up and doing separate
subsequent operations with the two batches. subsequent operations with the two batches. This has come up once in my
This has come up once in my [zucchini bread [zucchini bread recipe](https://tilde.town/~gamerdonkey/recipes/lemony_olive_oil_zucchini_bread.html),
recipe](https://tilde.town/~gamerdonkey/recipes/lemony_olive_oil_zucchini_bread.html), and I worked around the issue by adding an instruction to set the ingredients
and I worked around the issue by just adding an instruction to set the aside and use them later.
ingredients aside and use them later.