Repository navigation
Conversation
- a pipe between components makes them options for one slot, and the first is the default; the sigil is repeated on every option - a later option can take the first one's amount or its name; round brackets hold several components that replace one; a reason in square brackets follows an option - `?label` ties an option, a single component, a step (`?label:`), a note or a section (`= Name ?label`) to a named decision - choices are declared, by `?choice=option` or in front matter, never by position; any other label is a toggle, off by default - front-matter `choices` names decisions, orders and describes their options and lets an option replace `time`, `servings` or `yield` - two parts: options on a component can be accepted without labels - addresses discussions #68, #75 and #122
- the three examples of a pipe between components now write the sigil on every option, the form proposed in 0025 (#162) - no change to what this proposal defines: its pipe is inside the braces
- a timer takes a label like an ingredient or a cookware item, and is then a timer only when the label is active - timers are still not options: a pipe between two timers is text, with a canonical case and a diagnostic for it - timers as options added to the open questions
- a pipe between two timers makes a timer group, the first is the default: 40 minutes, or 12 when the air-fryer label is active - each timer option is written in full, and every one after the first needs a label - a timer is not an option beside an ingredient or a cookware item - "timers as options" leaves the open questions
|
I want this. Substitutes cannot be expressed today at all: written as a note the substitute is absent from the ingredient list, the shopping list and pantry matching, and written as a second ingredient the shopping list asks for both. That is the case for the feature, and I do not think anything else in the open proposals is as clearly missing. I agree it is heavy, and if it does go ahead I think part 1 is where the value is, which the proposal already allows for. My only hesitation is timing. Once something is in the spec it cannot be taken back out, and for a feature this size I would want an implementation first, so the spec does not formalise something that turns out not to be buildable, or not reasonable to build. YAML is the cautionary case, a spec with corners almost no parser implements. Same point I made on #148. There is also structural work in the cooklang-rs parser that should come first, so I would rather spend my effort there before digging into this properly. I will write that up on its own rather than argue it in pieces across proposals, so take this as a note on sequencing and not as an objection. |
|
The proposal has five open questions. Here they are in one place, each with what the draft says today and the other way it could go. The numbers match the "Open questions" section of the proposal. Views on any of them are welcome. 1. A selection outside the recipe. A shopping list, a menu and a reference from another recipe all need a way to say "the sourdough path of Country Loaf". The draft leaves this out: a reference with no selection means the default path. The nearest precedent is the selection lines that 0018 added to 2. A name with no braces straight before a label or an amount option.
Should braces be required in both places? 3. A labelled section with no name. 4. The opposite of a toggle. There is no "not". A step that is in the recipe only when a toggle is off has to be written as a choice with two options, 5. Canonical tests. The tests need a shape for a group, for a label and for |
Adds a way to write "or" that applications can read: options for one ingredient or cookware slot, and labels that tie steps, notes and sections to a named decision.
Rendered proposal
Summary
|between components makes them options for one slot, and the first is the default:@butter{50%g}|@ghee{40%g},#blender{}|#food processor{}. The sigil is repeated on every option. Timers can be options of each other when the later ones carry a label:~{40%minutes}|~{12%minutes}?air-fryer.|@cod,|@crème fraîche{}) or its name (|{300%g}). Round brackets hold several components that replace one:@egg{1}|(@ground flax{1%tbsp} + @water{3%tbsp}).[reason]after an option says when to pick it.?labelties an option, a single component or timer, a step (?air-fryer: Cook at …), a note or a section (= Pastry ?homemade) to a named decision, so one decision can change several places at once.?choice=optionin the text or bychoicesin front matter, and never inferred from position. Any other label is a toggle, off by default.choicesnames decisions, orders and describes their options, and lets an option replacetime,servingsoryield.choices).Motivation
A recipe that says
@butter{} or @ghee{}puts both on the shopping list. One that says "or ghee" loses the second from the list, from pantry matching and from search. Cookware has the same problem. Bigger choices (oven or air fryer, home-made or bought pastry, same-day yeast or overnight sourdough) have no form at all, so people keep two files or write both versions in prose, and the lists, the timers and the total time are wrong for at least one of them.0018 left optional steps and sections for a future proposal. Meanwhile implementations have their own forms: tmlmt's parser (inline and grouped alternatives, variants), Gram (
@milk{100ml}|@water{95ml}), and the front-matter variables proposed in #149.Addresses discussions #68, #75 and #122.
Things worth a reviewer's attention
@butter{}|@ghee{}, not@butter{}|ghee{}. Each option is a complete component, so an application that predates this proposal still highlights and lists it. The sigil after the pipe is also what tells it apart from the cooklang-rs alias pipe (@white wine|wine{}). tmlmt's parser writes the sigil once.@double cream{300%ml}|@crème fraîche{}is 300 ml of either. Everywhere else{}means no amount.?after a component. 0018 turned down a suffix marker,@thyme{}?, because of sentences likeDid you add the @salt{}?. A label needs a name glued to the?, so that sentence stays text..shopping-listor.menufile or on a recipe reference. Until that is defined, a reference means the default path.@cod?mild,@water|{300%g}), a labelled section with no name, the opposite of a toggle, and the shape of the canonical tests.This PR contains the proposal only; README, EBNF, conventions and test updates follow once it is accepted.