Replies: 8 comments
-
This a very common feedback and I think we need to address this on priority. I suggest replacing I though about using space as an implicit separator and keeping also explicit separator in cases when space doesn't work:
But I don't know how to handle cases when we want quantity to keep the space and signal parser to not split by quantity and units. Here's an artificial example:
Something like that?
|
Beta Was this translation helpful? Give feedback.
-
I think * is better, less dense. I think reading 1/2 is easier to read than 1 / 2, but that's up to personal tastes. |
Beta Was this translation helpful? Give feedback.
-
@DusteDdk I'll keep the issue open until we make this change or decide to not do one. |
Beta Was this translation helpful? Give feedback.
-
The scanner can eat characters until the first letter in the stream and then the parser will treat accumulated characters as a number or a fraction and handle the rest of the stream as a measurement unit. I can't think of a measurement unit which doesn't start with a letter. |
Beta Was this translation helpful? Give feedback.
-
Mixed numbers may be desired in some cases. e.g. {4 1/2*cups} |
Beta Was this translation helpful? Give feedback.
-
So I did a bit of comparison between Overall, I don't think it deserves introducing a breaking change. Does anybody have any other idea? |
Beta Was this translation helpful? Give feedback.
-
I don't see the need for any extra punctuation; it's quite easy to build a parser (and EBNF) which can handle all the obvious ways that a human would write it, e.g. https://regex101.com/r/D3KDJy/1 Admittedly that's not gonna be perfect, but OTOH it took me about 3 minutes to write, so I don't think it would be hard to come up with something robust. In general, I would suggest taking a leaf out of Markdown's book as an overall design principle:
Markdown became wildly popular because of this, and I believe that similarly, the closer cooklang is to natural (i.e. human) recipe language, the more attractive it will be for users. |
Beta Was this translation helpful? Give feedback.
-
Also, using an asterisk to separate amount and unit would conflict with the proposed serving size/ingredient scaling syntax (which I think should stay the same, since |
Beta Was this translation helpful? Give feedback.
-
the {AMOUNT%UNIT} syntax is a bit hard on the eyes, you could match for a space instead, in javascript, the following would return an array where index 1 is the amount and index 2 is the unit, this does not support amounds with spaces in them, which may be an issue.
/{(\S) (.*)}/
Beta Was this translation helpful? Give feedback.
All reactions