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

Reconsider syntax rules for empty/absent tag values #27

Closed
jotaen opened this issue Apr 8, 2022 · 2 comments · Fixed by #32
Closed

Reconsider syntax rules for empty/absent tag values #27

jotaen opened this issue Apr 8, 2022 · 2 comments · Fixed by #32

Comments

@jotaen
Copy link
Owner

jotaen commented Apr 8, 2022

Currently, the (draft!) spec says about tag values:

A tag MUST start with the hash character (#), followed by one or more characters for the name of the tag. There MAY follow an equals sign (=) along with one or more characters for the value of the tag.

Based on this, the following things cannot be written:

  • #tag=
  • #tag=""
  • #tag=''

However, what does it mean that this cannot be written? Shall either the whole tag or the value part be marked as invalid? Or just be ignored?

On the one hand, #tag= etc. doesn’t have any “meaning”; on the other hand, it also doesn’t do any harm (as far as I see). So I suppose it eventually comes down to the question which is more convenient for both users and tool-builders.

Functionality-wise, these cases should behave the same as writing #tag, so absent tag value is the same as empty tag value.

1.) Allow tag values to be empty

One option would be to adjust the spec, to allow tag values to be empty:

There MAY follow an equals sign (=) along with any number of characters for the value of the tag.

It then should also be clarified that empty tag value must be interpreted the same as absent tag value.

@delfiin
Copy link

delfiin commented Apr 8, 2022

Of course I'm thinking about it from my perspective.
I am parsing a line e.g. it has #tags and more of #them=tags into something like

{
  "#tags": true,
  "#them": "tags"
}

Without a value the equals sign doesn't make sense.
Also the spec says that tags can be enclosed by blanks or punctuation. Therefore if = is punctuation, we can just ignore it and parse the tag without, if not, I guess we could ignore the whole tag like a#tag.

@jotaen
Copy link
Owner Author

jotaen commented Apr 8, 2022

I’ve actually also opened #28 as separate thing to clarify, because I’m not super happy with the phrasing of the rules which characters may appear around tags and due dates.

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

Successfully merging a pull request may close this issue.

2 participants