Refactor to store tags as individual attributes

Each tag is stored as `tag_<tagname>: x`.  The `x` is required because
empty attributes are treated as nonexistent.

For compatibility, the `tags` attribute is updated in sync with the
per-tag attributes.  This compatibility support may be dropped in later
versions.

Note that synchronization _updates_ use JSON format, which does not
change with this patch, and thus no compatibility issues exist.  The
synchronization _initialization_, however, uses FF4, meaning that a
sync server initialized from a version of `task` with this patch will
contain `tag_<tagname>` attributes, which will look like orphaned UDAs
to older versions.  However, as updates to tasks are synchronized via
the sync server, the updates will not contain these attributes and they
will show as "deleted" in the `task info` display on the older version.
Aside from the noise in the `task info` output, this is harmless.
This commit is contained in:
Dustin J. Mitchell 2021-08-02 01:25:16 +00:00 committed by Tomas Babej
parent 17e6257e07
commit 20041c120e
6 changed files with 163 additions and 91 deletions

View file

@ -366,7 +366,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
// tags
value = findValue (after, "\n Tags:");
task.remove ("tags");
task.addTags (split (value, ' '));
task.setTags (split (value, ' '));
// description.
value = findMultilineValue (after, "\n Description:", "\n Created:");