I have a recipe that has a yield of 1.75 cups, and I marked it as such in the metadata:
---
servings: 1.75 # cup
---
Some instructions...
However, the playground gives me a warning:
Warning: Unsupported value for key: 'servings'
╰▶ Expected 'number' but got 'number'
╭─[playground]
│
2 │ servings: 1.75 # cup
┆ ─
──╯
And scaling doesn't work (behaves as if servings: 1 is set).
It looks like this is because the as_servings function in metadata.rs only tries u32 and string:
|
fn as_servings(&self) -> Option<Servings> { |
|
// Try as number first |
|
if let Some(n) = self.as_u32() { |
|
return Some(Servings::Number(n)); |
|
} |
Workaround
I could change the unit to be a whole number, but this isn't ideal.
I have a recipe that has a yield of
1.75cups, and I marked it as such in the metadata:However, the playground gives me a warning:
And scaling doesn't work (behaves as if
servings: 1is set).It looks like this is because the
as_servingsfunction inmetadata.rsonly triesu32andstring:cooklang-rs/src/metadata.rs
Lines 393 to 397 in b86eec6
Workaround
I could change the unit to be a whole number, but this isn't ideal.