-
Notifications
You must be signed in to change notification settings - Fork 137
File Format
ockham edited this page Dec 17, 2012
·
1 revision
Place to discuss about the sharing format for the recipes :
- Suggestion by Daniel and example : [file:rspml10draft.xsd] [file:example.xml]
- It would be better to have a child node for every tag. I also think it would be useful to add an attribute to determine the type of tag (Category, cuisine, ethny, difficulty). Also, we might want to allow hierarchical structure for the tags (Asian/Japanese...).
- The Ingredients section needs a way to specify a "group" of ingredients. And what about "ingredient" that are in fact reference to another recipe (A sauce recipe for example). Should the "sub-recipe" ingredients and steps be included in the same file. My suggestion is to allow the definition of more than one recipe per file.
- In the current Gourmet format, we use the tag <inggroup></inggroup> to do this -- works quite simply. Gourmet uses the <ingref></ingref> tag to encode recipes referred to as ingredients. -- Tom
- We need to be able to specify a range of amount. (2-3 apples, 2-4 cups of flour)
- In the current Gourmet format, we just store the amount as text. "2-3" would go in as "2-3". Gourmet already knows how to turn that into an internal representation of numbers (and it knows how to do the same for 2 1/2 - 5 1/2 as well). One of the things Gourmet's current format does a good job of is avoiding overengineering the format. We can have a DTD specify exactly what we mean -- with a range element and different types of amounts for numeric amounts of descriptive amounts etc etc, but in the end all that does is put more demand on the program to do more processing on import and export, and it makes it much harder to do a simple job, for example, displaying the XML format in human-readable form. So I guess I'd say, before we do something fancier than recording the amount of text, I'd need a convincing use case where having the extra info in the XML would make a difference. -- Tom
- Something really cool would be to have reference to the ingredients in the instructions. It is something that plugins can take advantage of to highlight the needed ingredients for a step (a kind of walkthrough) for example.
- This is a cool idea. It assumes an interface that uses "steps" -- I'm not sure how useful this is. Gourmet just uses paragraphs and allows users the flexibility to type things however they like. I've worked on another project that used steps to allow users to page through different parts of a recipe. I'm not totally convinced that steps provides you anything that paragraphs don't. The ingredient highlighting is one use case where it might help, but the same thing can be achieved by grouping ingredients in a way that matches steps -- i.e. "sauce", "marinade", etc., as is done in many cookbooks. -- Tom
- To allow all that, we need a way to refer to certain objects. So we need to specify nternal file ids.
- Some Recipes websites use "Yields" instead of "Servings" because a recipe can yield 2 cups of...so even if Gourmet will still refer to servings for now, we might want to use yield
- Absolutely -- Gourmet should be changed to use yield instead of servings. It will be simple to update old databases to do it. For me, the problem is only an interface problem -- it means adding one more control to the interface. -- Tom
- We might want to incorporate a Instruments node for future use (e.g. : this recipe need a balance)
- I think "Equipment" is the normal term. People have asked for this in the past. I figure you can use the "Notes" field for this, but I guess others disagree. It's another place where a plugin might come in handy.
- We need a way to specify that an ingredient is optionnal or an alternative to another one.
- Gourmet does this already -- it just uses an option attribute on the ingredient tag. I just noticed, though, that my export of my database sometimes includes some (optional) in the text of the ingredient item (how Gourmet displays optional ingredients) rather than using the tag -- a bug worth hunting down. -- Tom
- Should instructions support markup ? Or at least some tags ? What if the instructions are not divised in steps ?
- Absolutely. Gourmet does this again in the simplest way possible -- we store pango-allowed markup in escaped format in our XML format. Not very "pretty", but easy to process and functional. Obviously this doesn't feel "right" but the further I get in this project, the more I'm learning not to overengineer, so again, I'd like a compelling use-case for doing this another way before we do it another way :) -- Tom
- A example with some of the suggestions I made (Louis-Francis) :
&lt;file xmlns&#61;&quot;http&#58;//www.recipemanager.org&quot; xmlns&#58;xsi&#61;&quot;http&#58;//www.w3.org/2001/XMLSchema&#45;instance&quot;&gt; &lt;tags&gt; &lt;tag id&#61;&quot;1&quot; type&#61;&quot;ethny&quot;&gt;Asian&lt;/tag&gt; &lt;/tags&gt; &lt;recipe id&#61;&quot;1&quot;&gt; &lt;name&gt;Biscuit chinois&lt;/name&gt; &lt;description&gt;Humm...cookie&lt;/description&gt; &lt;picture type&#61;&quot;jpeg&quot;&gt;BLABLABLA&lt;/picture&gt; &lt;tags&gt; &lt;tag id&#61;&quot;2&quot; type&#61;&quot;category&quot;&gt;Desert&lt;/tag&gt; &lt;tag id&#61;&quot;3&quot; parent&#61;&quot;1&quot; type&#61;&quot;ethny&quot;&gt;China&lt;/tag&gt; &lt;tag id&#61;&quot;4&quot; type&#61;&quot;difficulty&quot;&gt;Difficult&lt;/tag&gt; &lt;/tags&gt; &lt;yield unit&#61;&quot;serving&quot;&gt;4&lt;/yield&gt; &lt;times&gt; &lt;time id&#61;&quot;1&quot; type&#61;&quot;cooking&quot;&gt;600&lt;/time&gt; &lt;time id&#61;&quot;2&quot; type&#61;&quot;preparation&quot;&gt;600&lt;/time&gt; &lt;time id&#61;&quot;3&quot; type&#61;&quot;inactive&quot;&gt;5000&lt;/time&gt; &lt;/times&gt; &lt;ingredients&gt; &lt;group id&#61;&quot;1&quot;&gt;Pâte&lt;/group&gt; &lt;group id&#61;&quot;2&quot;&gt;Garniture&lt;/group&gt; &lt;ingredient id&#61;&quot;1&quot; group&#61;&quot;1&quot;&gt; &lt;item&gt;Flour&lt;/item&gt; &lt;amount unit&#61;&quot;cup&quot; type&#61;&quot;min&quot;&gt;3&lt;/amount&gt; &lt;amount unit&#61;&quot;cup&quot; type&#61;&quot;max&quot;&gt;4&lt;/amount&gt; &lt;/ingredient&gt; &lt;ingredient id&#61;&quot;2&quot; group&#61;&quot;1&quot;&gt; &lt;item&gt;Egg&lt;/item&gt; &lt;amount unit&#61;&quot;none&quot;&gt;3&lt;/amount&gt; &lt;/ingredient&gt; &lt;ingredient id&#61;&quot;3&quot; group&#61;&quot;2&quot;&gt; &lt;item&gt;Rasberry jam&lt;/item&gt; &lt;amount unit&#61;&quot;cup&quot;&gt;3&lt;/amount&gt; &lt;/ingredient&gt; &lt;ingredient id&#61;&quot;4&quot; group&#61;&quot;2&quot; alternative&#61;&quot;3&quot;&gt; &lt;item type&#61;&quot;recipe&quot; id&#61;&quot;2&quot;/&gt; &lt;amount unit&#61;&quot;time&quot;&gt;2&lt;/amount&gt; &lt;/ingredient&gt; &lt;/ingredients&gt; &lt;instruments&gt; &lt;instrument id&#61;&quot;1&quot;&gt; &lt;name&gt;Plaque&lt;/name&gt; &lt;/instrument&gt; &lt;instrument&gt; &lt;directions&gt; &lt;step id&#61;&quot;1&quot;&gt;Mix together the ingredients for the &lt;ref type&#61;&quot;group&quot; id&#61;&quot;1&quot;&gt;pâte&lt;/ref&gt;.&lt;/step&gt; &lt;step id&#61;&quot;2&quot;&gt;Incorporate the &lt;ref type&#61;&quot;group&quot; id&#61;&quot;2&quot;&gt;garniture&lt;/ref&gt;.&lt;/step&gt; &lt;step id&#61;&quot;3&quot;&gt;Placer sur la &lt;ref type&#61;&quot;instrument&quot; id&#61;&quot;1&quot;&gt;plaque&lt;/ref&gt;.&lt;/step&gt; &lt;step id&#61;&quot;4&quot;&gt;Mettre au four à &lt;temp unit&#61;&quot;celsius&quot;&gt;400&lt;/temp&gt; pendant &lt;ref type&#61;&quot;time&quot; id&#61;&quot;1&quot;&gt;2 minutes&lt;/ref&gt;.&lt;/step&gt; &lt;/directions&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;2&quot;&gt; &lt;name&gt;Sauce à biscuit&lt;/name&gt; &lt;description&gt;Humm...cookie sauce&lt;/description&gt; &lt;yield unit&#61;&quot;cup&quot;&gt;2&lt;/yield&gt; &lt;tags&gt; &lt;tag id&#61;&quot;2&quot; /&gt; &lt;tag id&#61;&quot;3&quot; /&gt; &lt;tag id&#61;&quot;5&quot; type&#61;&quot;difficulty&quot;&gt;Easy&lt;/tag&gt; &lt;/tags&gt; &lt;ingredients&gt; &lt;ingredient id&#61;&quot;5&quot;&gt; &lt;item&gt;Sugar&lt;/item&gt; &lt;amount unit&#61;&quot;cup&quot;&gt;1&lt;/amount&gt; &lt;/ingredient&gt; &lt;ingredient id&#61;&quot;6&quot;&gt; &lt;item density&#61;&quot;4&quot;&gt;Milk&lt;/item&gt; &lt;amount unit&#61;&quot;cup&quot;&gt;1&lt;/amount&gt; &lt;/ingredient&gt; &lt;ingredient id&#61;&quot;7&quot;&gt; &lt;item&gt;Coconut&lt;/item&gt; &lt;amount unit&#61;&quot;cup&quot;&gt;1&lt;/amount&gt; &lt;optional&gt;True&lt;/optional&gt; &lt;/ingredient&gt; &lt;ingredients&gt; &lt;instruments&gt; &lt;instrument id&#61;&quot;2&quot;&gt; &lt;name&gt;Batteur&lt;/name&gt; &lt;optional&gt;True&lt;/optional&gt; &lt;/instrument&gt; &lt;instrument&gt; &lt;directions&gt; &lt;step id&#61;&quot;5&quot;&gt;Mix the &lt;ref type&#61;&quot;ing&quot; id&#61;&quot;5&quot;&gt;sugar&lt;/ref&gt; and the &lt;ref type&#61;&quot;ing&quot; id&#61;&quot;6&quot;&gt;milk&lt;/ref&gt;.&lt;/step&gt; &lt;step id&#61;&quot;6&quot;&gt;Wait&lt;/step&gt; &lt;step id&#61;&quot;7&quot;&gt;Repeat &lt;ref type&#61;&quot;step&quot; id&#61;&quot;6&quot;&gt;previous step&lt;/ref&gt;.&lt;/step&gt; &lt;/directions&gt; &lt;/recipe&gt;
Here's a snipped of Gourmet's current format. Again -- so far I'm not seeing any major differences, so I'm not convinced it would be worth coding time to change formats dramatically.
&lt;?xml version&#61;&quot;1.0&quot; encoding&#61;&quot;UTF&#45;8&quot;?&gt; &lt;&#33;DOCTYPE gourmetDoc&gt; &lt;gourmetDoc&gt; &lt;recipe id&#61;&quot;1&quot;&gt; &lt;title&gt; Fancy Ingredient Grouping &lt;/title&gt; &lt;rating&gt; 4/5 stars &lt;/rating&gt; &lt;ingredient&#45;list&gt; &lt;inggroup&gt; &lt;groupname&gt; Dressing &lt;/groupname&gt; &lt;ingredient&gt; &lt;amount&gt; 1/2 &lt;/amount&gt; &lt;unit&gt; tsp. &lt;/unit&gt; &lt;item&gt; red pepper flakes &lt;/item&gt; &lt;key&gt; red pepper flakes &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;item&gt; handful oregano &lt;/item&gt; &lt;key&gt; handful oregano &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;item&gt; handful basil &lt;/item&gt; &lt;key&gt; basil, handful &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1/4 &lt;/amount&gt; &lt;unit&gt; c. &lt;/unit&gt; &lt;item&gt; balsamic vinegar &lt;/item&gt; &lt;key&gt; vinegar, balsamic &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1/4 &lt;/amount&gt; &lt;unit&gt; c. &lt;/unit&gt; &lt;item&gt; olive oil &lt;/item&gt; &lt;key&gt; oil, olive &lt;/key&gt; &lt;/ingredient&gt; &lt;/inggroup&gt; &lt;inggroup&gt; &lt;groupname&gt; Pasta Salad Base &lt;/groupname&gt; &lt;ingredient&gt; &lt;item&gt; feta cheese &lt;/item&gt; &lt;key&gt; cheese, feta &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 12 &lt;/amount&gt; &lt;unit&gt; oz. &lt;/unit&gt; &lt;item&gt; whole&#45;wheat pasta &lt;/item&gt; &lt;key&gt; pasta, whole&#45;wheat &lt;/key&gt; &lt;/ingredient&gt; &lt;/inggroup&gt; &lt;inggroup&gt; &lt;groupname&gt; Add cold&#58; &lt;/groupname&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;item&gt; handful kalamata olives &lt;/item&gt; &lt;key&gt; handful kalamata olives &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 2 &lt;/amount&gt; &lt;item&gt; tomatoes &lt;/item&gt; &lt;key&gt; tomato &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;item&gt; cucumber &lt;/item&gt; &lt;key&gt; cucumber &lt;/key&gt; &lt;/ingredient&gt; &lt;/inggroup&gt; &lt;inggroup&gt; &lt;groupname&gt; Saute and add &lt;/groupname&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;item&gt; red pepper &lt;/item&gt; &lt;key&gt; red bell pepper &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;item&gt; bell pepper &lt;/item&gt; &lt;key&gt; bell pepper, green &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 4 &lt;/amount&gt; &lt;unit&gt; oz. &lt;/unit&gt; &lt;item&gt; mushrooms &lt;/item&gt; &lt;key&gt; mushrooms &lt;/key&gt; &lt;/ingredient&gt; &lt;/inggroup&gt; &lt;/ingredient-list&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;2&quot;&gt; &lt;title&gt; Formatting &lt;/title&gt; &lt;category&gt; Dessert &lt;/category&gt; &lt;rating&gt; 5/5 stars &lt;/rating&gt; &lt;preptime&gt; 20 minutes &lt;/preptime&gt; &lt;servings&gt; 5 &lt;/servings&gt; &lt;ingredient&#45;list&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;unit&gt; c. &lt;/unit&gt; &lt;item&gt; sugar &lt;/item&gt; &lt;key&gt; sugar, white &lt;/key&gt; &lt;/ingredient&gt; &lt;/ingredient-list&gt; &lt;instructions&gt; &amp;amp&#59;lt&#59;b&amp;amp&#59;gt&#59;This should be in bold&amp;amp&#59;lt&#59;/b&amp;amp&#59;gt&#59; This should be plain &amp;amp&#59;lt&#59;i&amp;amp&#59;gt&#59;This&amp;amp&#59;lt&#59;/i&amp;amp&#59;gt&#59; should be in italics, &amp;amp&#59;lt&#59;u&amp;amp&#59;gt&#59;this&amp;amp&#59;lt&#59;/u&amp;amp&#59;gt&#59; should be underline, and &amp;amp&#59;lt&#59;u&amp;amp&#59;gt&#59;&amp;amp&#59;lt&#59;b&amp;amp&#59;gt&#59;&amp;amp&#59;lt&#59;i&amp;amp&#59;gt&#59;this should be everything that is special&#33;&amp;amp&#59;lt&#59;/i&amp;amp&#59;gt&#59;&amp;amp&#59;lt&#59;/b&amp;amp&#59;gt&#59;&amp;amp&#59;lt&#59;/u&amp;amp&#59;gt&#59; &lt;/instructions&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;3&quot;&gt; &lt;title&gt; Link Recipe &lt;/title&gt; &lt;source&gt; Google &lt;/source&gt; &lt;link&gt; http&#58;//www.google.com &lt;/link&gt; &lt;servings&gt; 4 &lt;/servings&gt; &lt;ingredient&#45;list&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;unit&gt; cup &lt;/unit&gt; &lt;item&gt; sugar &lt;/item&gt; &lt;key&gt; sugar, white &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 2 &lt;/amount&gt; &lt;unit&gt; cups &lt;/unit&gt; &lt;item&gt; flour &lt;/item&gt; &lt;key&gt; flour, all purpose &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1 &lt;/amount&gt; &lt;unit&gt; cup &lt;/unit&gt; &lt;item&gt; butter &lt;/item&gt; &lt;key&gt; butter &lt;/key&gt; &lt;/ingredient&gt; &lt;/ingredient-list&gt; &lt;instructions&gt; This recipe is really radical. What you do is start with some ingredients and then google them. &lt;/instructions&gt; &lt;modifications&gt; This is a lovely note. &lt;/modifications&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;4&quot;&gt; &lt;title&gt; Ranges &lt;/title&gt; &lt;category&gt; Dessert &lt;/category&gt; &lt;cuisine&gt; Asian/Thai &lt;/cuisine&gt; &lt;source&gt; Epicurious &lt;/source&gt; &lt;rating&gt; 1.5/5 stars &lt;/rating&gt; &lt;preptime&gt; 1/2 hour &lt;/preptime&gt; &lt;cooktime&gt; 20 minutes &lt;/cooktime&gt; &lt;servings&gt; 4 &lt;/servings&gt; &lt;ingredient&#45;list&gt; &lt;ingredient&gt; &lt;amount&gt; 2&#45;4 &lt;/amount&gt; &lt;item&gt; carrots &lt;/item&gt; &lt;key&gt; carrot &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1&#45;3 &lt;/amount&gt; &lt;item&gt; onions &lt;/item&gt; &lt;key&gt; onion &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 1 1/2&#45;2 3/4 &lt;/amount&gt; &lt;unit&gt; tsp. &lt;/unit&gt; &lt;item&gt; sugar &lt;/item&gt; &lt;key&gt; sugar, white &lt;/key&gt; &lt;/ingredient&gt; &lt;ingredient&gt; &lt;amount&gt; 2 1/4&#45;4 1/2 &lt;/amount&gt; &lt;unit&gt; c. &lt;/unit&gt; &lt;item&gt; flour &lt;/item&gt; &lt;key&gt; flour, all purpose &lt;/key&gt; &lt;/ingredient&gt; &lt;/ingredient-list&gt; &lt;instructions&gt; This isn&#39;t a real recipe&#33; &amp;amp&#59;lt&#59;i&amp;amp&#59;gt&#59;But this should be in italics&amp;amp&#59;lt&#59;/i&amp;amp&#59;gt&#59; &amp;amp&#59;lt&#59;b&amp;amp&#59;gt&#59;And this should be in bold&amp;amp&#59;lt&#59;/b&amp;amp&#59;gt&#59; This recipe should have 1 and 1/2 stars. &lt;/instructions&gt; &lt;modifications&gt; And these are notes. &lt;/modifications&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;5&quot;&gt; &lt;title&gt; Recipe with Image and Times &lt;/title&gt; &lt;category&gt; Dessert &lt;/category&gt; &lt;cuisine&gt; Asian/Chinese &lt;/cuisine&gt; &lt;source&gt; Tom &lt;/source&gt; &lt;rating&gt; 4/5 stars &lt;/rating&gt; &lt;preptime&gt; 1/2 hour &lt;/preptime&gt; &lt;cooktime&gt; 20 minutes &lt;/cooktime&gt; &lt;servings&gt; 4 &lt;/servings&gt; &lt;image format&#61;&quot;jpeg&quot;&gt; &lt;&#33;&#91;CDATA&#91;raw&#45;jpeg&#45;data&#93;&#93;&gt;&lt;/image&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;6&quot;&gt; &lt;title&gt; Reference Recipe &lt;/title&gt; &lt;rating&gt; 3/5 stars &lt;/rating&gt; &lt;servings&gt; 3 &lt;/servings&gt; &lt;ingredient&#45;list&gt; &lt;ingref amount&#61;&quot;1&quot; refid&#61;&quot;4&quot;&gt; Ranges &lt;/ingref&gt; &lt;/ingredient-list&gt; &lt;instructions&gt; This recipe called our other reference recipe as an ingredient. &lt;/instructions&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;13&quot;&gt; &lt;title&gt; Duplicate Title &lt;/title&gt; &lt;instructions&gt; This is the first of two duplicates. &lt;/instructions&gt; &lt;/recipe&gt; &lt;recipe id&#61;&quot;14&quot;&gt; &lt;title&gt; Duplicate Title &lt;/title&gt; &lt;instructions&gt; This is the second of two duplicates. &lt;/instructions&gt; &lt;/recipe&gt; &lt;/gourmetdoc&gt;