Recipes

/media/docs/recipes/english_muffins/20110619_003.jpg

I have a series of notebooks in my kitchen to record recipes and keep track of my cooking experiments. I used to use a small notebook but it was awkward, it wouldn't stay open on the counter and the rubber band holding it closed was starting to fail, so I moved to a new larger book, even transcribing some of my recipes over, but this too had problems. The new notebook was used for both recipes and as an experimental log book and I found it difficult to do both and keep things understandable. I also found myself wanting to reference my recipes when I wasn't at home. For these reasons I decided to move all of my recipes to my website.

The old method of generating static documents on my site was complicated enough to require a checklist:

  • Start the podman container
podman-compose up
  • Create a subdirectory and add images
  • Fix permissions on the subdirectory
  • Build transient text files with:
podman exec -it tr_djangoapp_1 /tr/trousermonkey/trousermonkey/thumbnail.py --doc foo_directory_name
  • Create/rebuild the html with:
podman exec -it tr_djangoapp_1 /tr/trousermonkey/manage.py shell --command="from docs.views import build_doc;build_doc('foo_directory_name')"
  • Resize thumbnails with:
podman exec -it tr_djangoapp_1 /tr/trousermonkey/trousermonkey/thumbnail.py -r foo_directory_name

I used this to generate all my static documents but I had to look up the steps each time and the code to generate thumbnails, resize images, and compile the markup language was old. It used old python idioms and it rebuilt and resized everything from scratch regardless of whether it needed to.

To support a useful index of recipes I needed to make this easier else I'd never find the energy to update pages as they changed.

I transcribed the 47 recipes from my notebook to restructured text in a standard format and yesterday I finished the new static document generation routines. I rewrote the thumbnail generation scripts (although as separate functions until I could get all the static page generation switched over) and now they're easier to reason about and test. After all this work I can now add or modify any recipe with:

podman-compose up
build_recipes

The new script will only rebuild files that have changed or images that need a resize and it generates better markup template files than the old method.

This morning I deleted the existing recipes from the documents page (because they were redundant, too verbose, and in a non-standard format) and added a new link to my recipe collection.

Most of the recipes are lacking pictures and there could be lingering formatting errors but these will be easy to fix and I intend on getting into the habit taking pictures and updating the recipes as I make them.