Closed lucharo closed 11 months ago
I don't think its a good idea to include non marked-down ingredients when found, in the step field of an ingredient node. It's my firm belief that unless it is non-text node (@ingredient
, #cookware
, ect) it should not effect the nodes in each list of ingredients, cookware, ect. This is because each node, lets say the in ingredient array, represents a singe mention in the recipe. I'm open to suggestions, and maybe I'm misunderstanding your problem. (The wrong step number is a separate issue I will fix)
Fixed issue in 4de62a882bbf948095a94b5ed4f006dee02b9a73.
Describe the bug A while ago I requested expanding the AST to include the step number(s) for the ingredients in a recipe. I've now realized that the cooklang specification suggests only mentioning each ingredient once:
so because of this the step element in the AST doesn't properly work when an ingredient is used in several steps, e.g. Chop cabbage in step 1, put potatoes in the oven in step 2, combine potatoes and cabbage in step 3. With the cooklang suggested specification cabbage would only list step 1 and potatoes would only list step 2 rather than listing steps 1,3 and steps 1,2 respectively.
I realize that I can omit the cooklang spec suggestion and just add @ingredient{0} at every step but that would add
ingredient 0, 0, 0
to the ingredients list when parsed.Note while writing out the issue: I'm getting every step number to be wrong by 1 (step listed as 3 instead of 2 when ingredient listen in 2nd step)
To Reproduce I have a recipe that repeats ingredients in several steps (tomatoes) as you can tell tomatoes only list step number 1 instead of all the steps they're needed in
I run it with
ts-node
and I get:Expected behavior
Actually just noticed that I'm getting the wrong step number (3) instead of 2