The current tag syntax is creating at least one bug in my code and some some confusion when others are trying to read TaskPaper files. I think the solution is to force that
( is escaped in addition to
) which already must be escaped. Unfortunately this change will bread existing tag values that have unescaped
The root of the problem is when you write
@tagname( everything that follows is considered tag value up until an unescaped
) is encountered. In some cases this causes confusion, but it also breaks part of TaskPaper's internal API. The Item.setAttribute method works like this in TaskPaper:
- Update the item's attribute value.
- Sync the plain text representation to match the value (i.e. add the @tagname(tagvalue) to the end of the line representing that item)
It's this second step that can break the API. For example in the bug cases reported above the user has typed
@due( and then they try to apply @done(date) by clicking the leading dash. It works internally, because step 1 succeeds. But when
@done(date) is appended to the string it really completes the easier
@due( tag syntax.
@done(date just becomes the value of the @due tag.
The only way that I can think to solve this is to just always require that () are escaped as tag values. That will then make it always safe to add () at the end of an items text without the worry that the added text becomes part of some easier tag. Since the leading unescaped ( will break things up.
I'm likely to make this change in the next release, but since it's breaking figured I would post here to see if anyone else has a better idea.