cooklang / cooklang/cookcli

Support nutrition metadata and scale it with servings

Open
#299 4 comments 0 reactions 0 assignees View on GitHub
feature request needs discussion requires spec update
Dominant language
Rust
Stars
1.4k
Forks
109
Avg merge
1d 22h
Merged PRs (30d)
19

Description

Some nutrition metadata would be interesting to display and compute depending on the servings.

### Quick and easy way

Support a new metadata tag and divide it by the number of servings.
Format proposal in recipe metadata:
```
---
servings: 1
# "Just" iterate over every entry in "nutrition" list and process it like ingredient quantities.
nutrition:
- 100%kcal
- 1%g of proteins
- 1%g of lipids
- 1%g of sugars
- 1%g of fibers
---
```
**Expected result for 3 servings:**

- 300 kcal
- 3 g of proteins
- etc.

_Note: One could imagine other usecases than "nutrition" data alone. A more generic way to handle such data could be useful but I don't have idea regarding a proper naming... -\_-'_

### Longer but more user friendly way

Integrate with the db format of cookcli-report to define the data for each ingredient and compute the values adding the data of all ingredients in the recipe. It could however have side effect for ingredients not actually integrated in the result such as cooking oils but one would only have to reduce the metadata for such ingredients in his database.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.