Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

key-value pairs starting with numerics #77

Open
clach04 opened this issue Sep 11, 2022 · 4 comments
Open

key-value pairs starting with numerics #77

clach04 opened this issue Sep 11, 2022 · 4 comments

Comments

@clach04
Copy link

clach04 commented Sep 11, 2022

Came up in #69 from @xsrvmy

Can/should keys be allowed to start with a number, i.e. 0-9? Current spec https://github.com/todotxt/todo.txt#additional-file-format-definitions implies this is currently allowed:

Developers should use the format key:value to define additional metadata (e.g. due:2010-01-02 as a due date).

Both key and value must consist of non-whitespace characters, which are not colons. Only one colon separates the key and value.

@rachmadaniHaryono recommends against using numbers which I concur with. However I'd go as far as saying the spec needs clarification here as this conflicts with how most people write times down, e.g. 11:00am doesn't seem to me to be a useful key of "11" and value of "00am".

@clach04
Copy link
Author

clach04 commented Sep 11, 2022

Related but possibly more of an extension #64

@xsrvmy
Copy link

xsrvmy commented Sep 11, 2022

Another possibility is that double colon will escape a colon. This is currently simply invalid syntax since a key or a value can't contain a colon.

@jgclark
Copy link

jgclark commented Sep 12, 2022

There appears to be a universal rule (but no spec that I can find) that says #hashtags can't start with a numeral, as they often mean a list item (as indeed they do in GH).
They're not the same as keys, but I would apply the same logic.

@jgclark
Copy link

jgclark commented Sep 12, 2022

Also, borrowing from other key:value systems, all examples of YAML at yaml.org use a space character after the separator colon. I can't find this in the spec, but its common usage.
JSON too, often is written out with a space after the separator colon.
So, I suggest there has to be a good reason to disallow whitespace after the separator colon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants