Repository navigation
feat(server): --inline-quantities shows each ingredient's quantity in the step - #832
Open
alangrainger wants to merge 1 commit into
Open
alangrainger wants to merge 1 commit into
alangrainger wants to merge 1 commit into
Conversation
Member
|
I was thinking to make this default replacing current view. I wasn't sure about how other languages will work and also after scaling we might need to modify words. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optional. Shows inline ingredients in recipe steps:
Instead of: "Bring water to a boil. Add pasta."
Shows as: "Bring 4 cups water to a boil. Add 250g pasta."
Personally I think this should be the default display. This is what attracted me to Cooklang spec in the first place, because it's so much easier to follow a recipe like this - without having to look back and forwards from the step to the amounts.
Adds
cook server --inline-quantities(alsoCOOK_INLINE_QUANTITIES=1, for containers). With it on, each ingredient badge inside a step carries the scaled quantity. The line under the step then lists only the ingredients that have a preparation note ("garlic (lightly smashed)"), so nothing shows twice and notes are still there.Addresses #337. The default is unchanged: the badge shows the name and the line under the step shows the amounts. It is a server flag rather than a preference cookie, so it follows the
--recipes-onlypattern.How it works:
FeatureFlagsgainsinline_quantities. The recipe page handler sets it from the server's--inline-quantitiesflag.StepItem::Ingredientgains alabel: the name, with the quantity and unit in front of it when the flag is on. The builder derives it beside the step summary line, which then keeps only noted ingredients. Scaling comes for free since the builder gets the scaled recipe.templates/recipe.htmlrenderslabelin the badge. Cooking mode clones the step body, so it shows the same.cook build webis unaffected (the flag defaults to off there).Tests: two unit tests in
src/web/builders.rsand a Playwright spec,tests/e2e/inline-quantities.spec.ts, that starts a server with the flag. Documented indocs/server.md.