Repository navigation
Proposal 0018: optional ingredients and cookware - #153
Conversation
- standardise the `?` marker (`@?thyme`, `#?stand mixer{}`) from the
cooklang-rs component modifiers extension; other modifiers stay extensions
- optionality is per occurrence; required and optional amounts aggregate
separately
- extend the shopping list format (0016) with `? name` selection lines so
optional ingredients are opt-in per recipe
- `? name{quantity}` stores the final, already scaled amount to buy, so
totals are a plain sum with no recipe lookup
- several selection lines with the same name each contribute, covering
recipes that use the same optional ingredient more than once
- accepted optional recipe references carry their multiplier
|
About the "Semantics" paragraph in the PR summary, or the "Aggregation" section in the spec proposal: quantities don't aggregate without the |
|
I too am a little confused by the Semantics and aggregation. "Never" implies no possible way. That feels like a miss. Perhaps a toggle in the CLI or web views of the recipes to include optional ingredients in a separate part of the list? That way I can see what the recipe requires, then see what optional ingredients are listed, which I may not have and want to buy, or may not think about including them without looking at them in the list. |
|
I think we need to separate what parser outputs and how apps display it. In some contexts we should separate these ingredients and in some not, so the parser itself shouldn't aggregate ingredients and leave this option to the consumer (the apps). Saying that parser should provide tools to aggregate ingredients, so apps not re-implementing them. |
Moves the optional marker
?from a parser extension into the spec.Rendered proposal
Summary
?immediately after the sigil marks an ingredient or cookware as optional —@?thyme,@?chilli flakes{1%pinch},#?splatter guard{}. The?is not part of the name; parsers expose anoptionalboolean. Timers are unaffected.?is standardised. The other cooklang-rs component modifiers (&,-,+,@@) remain extensions.parmesan 100 g+parmesan 50 g (optional)), so the required total never includes skippable amounts.Motivation
@?thymealready works in cooklang-rs behind theCOMPONENT_MODIFIERSflag and authors use it, but because it isn't in the spec, tools disagree: some show optional thyme, others a required ingredient named?thyme. See cooklang/cookcli#502, which works around this by enabling the whole modifiers bundle (and changes@-saltas a side effect).Related discussions: #50, #122.
This PR contains the proposal only; README, EBNF, canonical tests and conventions updates follow once it is accepted.