cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Support for ingredient grouping

Open pj83 opened this issue 5 years ago • 16 comments

Is your feature request related to a problem? Please describe. Some recipes have multiple parts to them (example here and therefore ingredients are grouped for individual parts of the meal. Currently i just have an additional ingredient line with ingredient group name in, but this makes seeing the grouping harder.

Describe the solution you'd like Ability to group ingredients for specific parts of a recipe. eg Main meal: ingredient1, 2 & 3. Sauce: ingredient 4 & 5)

Describe alternatives you've considered n/a

pj83 avatar Aug 23 '20 12:08 pj83

I think this has been discussed before, e.g., in #285 . Unfortunately, although I’d really like to see this feature, it seems not to be supported by schema.org.

Adding an ingredient separating the groups with an ingredient with ## in front of the text allows at least an optical separation.

## Main meal
200 g noodles
...
## Sauce
 80 g tomatoes
...

seyfeb avatar Aug 26 '20 19:08 seyfeb

I opened the PR schemaorg/schemaorg#2738 against Schema.org. If they accept it, there should be an option to group the ingredients accordingly. Until that is decided, I suggest to postpone this issue here. Then, we can decide how to proceed further.

christianlupus avatar Oct 14 '20 15:10 christianlupus

Thanks for the clarification. I'm sorry, that I didn't search the issues for this, so I could have found your answers already.

tj551955 avatar Nov 19 '20 10:11 tj551955

I found an example that uses grouped ingredients. I don’t know if this conforms to the schema.org standard, but in this form we currently cannot import the recipe instructions at all:

https://leitesculinaria.com/7759/recipes-pasteis-de-nata.html#recipe

seyfeb avatar Dec 07 '20 13:12 seyfeb

I just looked at it. The named recipe does only show in the website the ingredient grouping. The JSON has a straight list of ingredients.

I have not tested it but the structure is sort of awkward they use for the JSON+LD. They define a complete graph of objects and link them together. See for yourself: json.txt. It could be a problem with our parser, I might say.

christianlupus avatar Dec 07 '20 17:12 christianlupus

sry I mixed up ingredients and instructions. my bad. the instructions are grouped and can't be imported correctly. however, the logic is probably the same (?)

seyfeb avatar Dec 07 '20 17:12 seyfeb

What do you mean by logic? In the Schema.org standard the instructions can be of type HowToSection as in the named example. For the ingredients, no such structure is allowed. There only plain text is in the standard.

christianlupus avatar Dec 07 '20 18:12 christianlupus

Okay, that I didn’t know. Then we should check why the instructions can’t be imported. The ingredients worked fine. I open a different issue for this - this doesn’t fit here.

seyfeb avatar Dec 07 '20 18:12 seyfeb

Adding an ingredient separating the groups with an ingredient with ## in front of the text allows at least an optical separation.

Allowing Markdown as discussed in #47 would instantly make this a heading. I would love this!

rompe avatar Feb 02 '21 18:02 rompe

Allowing Markdown as discussed in #47 would instantly make this a heading. I would love this!

You have to distinguish between ingredients and instructions. Here we are discussing things related to ingredients. The problem is the need of structure but the missing support by the standard. I will have a look there. The trick with ## is just a workaround until a valid structure is settled.

In #47 the main point is adding images (the storage is an extended issue in this context) and related to instructions.

BTW with #381 the description will be able to use markdown as well.

christianlupus avatar Feb 04 '21 13:02 christianlupus

In #47 the main point is adding images (the storage is an extended issue in this context) and related to instructions.

I understood https://github.com/nextcloud/cookbook/issues/47#issuecomment-527124798 as if Markdown should be allowed in ingredient fields as well. Reading it again now I think I got that wrong and, in fact, #47 is completely unrelated.

BTW with #381 the description will be able to use markdown as well.

That's wonderful! Now just rendering markdown in any text field (read: ingredients as well) would do the trick for me, especially since it seems to be >80% result with <20% afford and it wouldn't stretch the standard too much.

rompe avatar Feb 07 '21 11:02 rompe

That's wonderful! Now just rendering markdown in any text field (read: ingredients as well) would do the trick for me, especially since it seems to be >80% result with <20% afford and it wouldn't stretch the standard too much.

Please open a new feature request to keep track of that wish.

christianlupus avatar Feb 07 '21 15:02 christianlupus

there appears to be no progress on the relevant schema.org issues https://github.com/schemaorg/schemaorg/issues/2628 and https://github.com/schemaorg/schemaorg/issues/882

to be able to continue to enhance/develop nc/cookbook, would it be an option to store recipes in the cookbook assuming https://schema.org/recipeIngredient: https://schema.org/ProductCollection or https://schema.org/TypeAndQuantityNode or https://schema.org/Text?

  • Cons
    • not within the standard
    • imported recipes would still use Text
  • Pros
    • support grouping itmes (for recipes created by nc/cookbook)
    • support list without grouping
    • store quantity in structured format (for recipes created by nc/cookbook)
    • based on the structured format UI can make use of it, for example to right-align quantity and left-align description
    • once schema.org provides a new standard, data stored in structured format can be converted

schaarsc avatar May 08 '22 11:05 schaarsc

It looks like one can achieve a visual separation of groups by using for ex. _Group name_ in the ingredient list. The only problem is that Cookbook than prints a warning about incorrect syntax (item not starting with a number). Would it be possible to not print the warning if the ingredient start with some specified character (for ex. _)? This could be used as a quick fix, until the schema improves...

mkaut avatar Mar 20 '24 18:03 mkaut

I would recommend using ## for ingredient-group titles. This should also prevent calculation errors (at least on the current master branch - not sure if it's already released).

seyfeb avatar Mar 20 '24 19:03 seyfeb