From d6c0690f598bc19bf1b27b2cb8e59344331e1d04 Mon Sep 17 00:00:00 2001 From: Thomas Lamant Date: Fri, 16 Jan 2026 00:04:27 +0100 Subject: [PATCH 1/2] docs: rename section to alternative ingredients --- docs/guide-extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide-extensions.md b/docs/guide-extensions.md index 6709a49..2d7c20b 100644 --- a/docs/guide-extensions.md +++ b/docs/guide-extensions.md @@ -123,7 +123,7 @@ Usage: `@flour{100%g|3.5%oz}` This is useful for providing multiple units (e.g. metric and imperial) simultaneously for the same ingredient. The first unit is considered the primary unit. -## Ingredient alternatives +## Alternative ingredients ### Inline alternatives From 6310cc6333d5033a9410094aa560807665c4af75 Mon Sep 17 00:00:00 2001 From: Thomas Lamant Date: Fri, 16 Jan 2026 00:09:17 +0100 Subject: [PATCH 2/2] docs(extensions): update output of ingredient alias example --- docs/guide-extensions.md | 120 +++++++++++++++++++++++++++++---------- 1 file changed, 89 insertions(+), 31 deletions(-) diff --git a/docs/guide-extensions.md b/docs/guide-extensions.md index 2d7c20b..c0a7186 100644 --- a/docs/guide-extensions.md +++ b/docs/guide-extensions.md @@ -4,7 +4,7 @@ outline: deep # Guide: language extensions -This parser library introduces multiple extensions of the original [cooklang language](/guide-cooklang-specs). Most of them are directly inspired by / in line with the extensions proposed by the official ([cooklang-rs](https://github.com/cooklang/cooklang-rs/blob/main/extensions.md)) Rust parser. +This parser library introduces multiple extensions of the original [cooklang language](/guide-cooklang-specs). Half of them are directly inspired by / in line with the extensions proposed by the official ([cooklang-rs](https://github.com/cooklang/cooklang-rs/blob/main/extensions.md)) Rust parser. List of extensions: @@ -167,44 +167,102 @@ Example: .cook string `Mix @wheat flour{100%g} with additional @&wheat flour|flo ```json { - metadata: {}, - ingredients: [ - { - name: "wheat flour", - quantity: { type: "fixed", value: { type: "decimal", value: 150 } }, - quantityParts: [{ value: { type: "fixed", value: { type: "decimal", value: 100 } }, unit: "g", scalable: true},{ value: { type: "fixed", value: { type: "decimal", value: 50 } }, unit: "g", scalable: true}] - unit: "g", - flags: [] + "metadata": {}, + "choices": { + "ingredientItems": { + "Map(0)": {} }, + "ingredientGroups": { + "Map(0)": {} + } + }, + "ingredients": [ + { + "name": "wheat flour", + "usedAsPrimary": true, + "quantities": [ + { + "quantity": { + "type": "fixed", + "value": { + "type": "decimal", + "decimal": 150 + } + }, + "unit": "g" + } + ] + } ], - sections: [ + "sections": [ { - name: "", - content: [ + "name": "", + "content": [ { - type: "step", - items: [ - { type: "text", value: "Mix " }, + "type": "step", + "items": [ { - type: "ingredient", - index: 0, - quantityPartIndex: 0 - displayName: "wheat flour", + "type": "text", + "value": "Mix " }, - { type: "text", value: " with additional " }, { - type: "ingredient", - index: 0, - quantityPartIndex: 1, - displayName: "flour", + "type": "ingredient", + "id": "ingredient-item-0", + "alternatives": [ + { + "index": 0, + "displayName": "wheat flour", + "itemQuantity": { + "quantity": { + "type": "fixed", + "value": { + "type": "decimal", + "decimal": 100 + } + }, + "unit": { + "name": "g" + }, + "scalable": true + } + } + ] }, - ], - }, - ], - }, + { + "type": "text", + "value": " with additional " + }, + { + "type": "ingredient", + "id": "ingredient-item-1", + "alternatives": [ + { + "index": 0, + "displayName": "flour", + "itemQuantity": { + "quantity": { + "type": "fixed", + "value": { + "type": "decimal", + "decimal": 50 + } + }, + "unit": { + "name": "g" + }, + "scalable": true + } + } + ] + } + ] + } + ] + } ], - cookware: [], - timers: [], -}; + "cookware": [], + "timers": [], + "arbitraries": [] +} ```