To better organize my recipes I would like to store them in a database instead of having plenty of books being scattered all around. There are many programs to realize this by offering a GUI to either the mealmaster and/or rezkonv format (the latter is very popular in Germany, both formats are very similar). However, at some point in time I would like to create small books from these recipes, e.g., as a present for friends. This question targets the issue on how to do this properly in an automated manner.
As a first step, I would like to discuss, which of the following options is the most reasonable.
- Use LaTeX to parse a complete rezkonv "database" (many recipes in a single file)
- Use LaTeX to parse a single rezkonv recipe at a time (each recipe is one file)
- Use an external tool (e.g. written in Python) to create suitable LaTeX files which can be further processed by including the resulting files.
To me, the most simple one would be to go for option (2). A book is unlikely to contain more than 150+ (?) recipes and I would argue that dealing with these recipes is easier if each one of them is in a single file (e.g., adding and removing a recipe is much easier).
So let's assume the following structure:
- main.tex includes everything required to create our cookbook
- recipe1.rk includes a single recipe
- recipe2.rk includes another recipe
No the question arises how to parse these files properly and allow "post-processing" within the LaTeX code (e.g., rearranging content, turning data being read into tables, applying "styles", etc). Ideally, one would be able to parse the data, extract it based on the identifiers of the specific file format (rezkonv) and finally rearrange/"print"/highlight it as desired, possibly by adding more stuff to the recipe which is not supported by the original file format (e.g., referring to other recipes that match well). Of course, adding photos and such should be possible (simply parsing the files and using them as a single page is not an option, a more 'advanced' approach is desired).
A possible realization may look like this:
...
\readrecipe{recipe1.rk}
\setstyle{soups}
\setheading{Grandma's uber-soup}
\printkey{ingredients,recipe1.rk}
% preparation time not mentioned in recipe, but we would like to have it anyway
\subsection*{Preparation}
lorem ipsum
\printkey{instructions,recipe1.rk}
...
\subsection*{Best matches}
\ref{recipe:mostdeliciousbread}
...
\readrecipe{recipe2.rk}
\setstyle{salads}
...
Whereas the style could be something like this (post by Yiannis Lazarides): Fancy chapter headings
So far, I did not do a lot of low-level programming in LaTeX. That's why I would probably go for option 3. However, I believe LaTeX should be able to do this, too. Others may also be interested in this. I would therefore like to ask for hints on how to realize this or to receive (best case) proof of concept code which could be extended. I'm willing to spend a nice bounty for good answers.
(pdflatex solutions preferred)
Edit: oh well .. here is an example:
========== 'Kalorio V4.03' (reg.) nach REZKONV
Titel: (2) Pellkartoffeln mit Kräuterquark und Schinken
Kategorien: Gemüse
Menge: 4 Personen
Zutaten:
1 kg Festkochende Kartoffeln
1/2 Bund Schnittlauch
1/2 Bund Glatte Petersilie
Etwas Frisches Basilikum zur Deko
1 Rote (ungarische) Spitzpaprika
1 Grüne (ungarische) Spitzpaprika
250 Gramm Quark mit 20% Fett
250 Gramm Quark mit 40% Fett
2 Schalotten
1 Essl. Kümmel
150 Gramm Saure Sahne (oder süfle Sahne)
Salz, Pfeffer
1 Prise Muskat
8 Scheiben Schinken, gekocht oder geräuchert
4 Tomaten
1 Stück Gurke
======================QUELLE======================
Christian Schill
Zubereitung:
Die Kartoffeln waschen und in der Schale in reichlich Wasser (1%
Salz) mit dem Kümmel ca. 20 Minuten garen.
[left out some text here]
Kartoffeln abgieflen, schälen und mit dem Kräuterquark und dem
Schinken anrichten.
Zubereitung: etwa 30 Minuten.
:Stichworte : Kartoffeln
:Stichworte : Gemüse
:Fingerprint : 30950473,-1032086772,Kalorio
=====

cdpayer.initoHTMLtables. See: http://jklatex.square7.de/download/cdplayer2html.awk as little example – Josef Feb 09 '14 at 12:24gawkand/orsedmaybe? – cfr Feb 09 '14 at 16:23