v0.3.0
Mdata is a textual key value file format.
Lines are separated by LF ("\n") characters.
Each line may contain a record.
The first "=" character separates the key from the value
i.e. keys cannot contain "=" characters, values can.
Whitespace is SPACE (" ") and TAB ("\t").
Keys and values are trimmed of leading and trailing whitespace.
Records with empty keys are ignored i.e. can be used as comments.
Records without a "=" characters have an empty value.
These records may be used as tags.
Duplicate keys may trigger undefined behavior.
Since mdata v0.3.0, keys and values are encoded.
This allows representing arbitrary keys and values without restrictions.
\\\n\v\t and \s\eUsing this encoding is discouraged as it adds complexity. I.e. the end user should be encouraged to not rely on any characters that require the encoding.
This makes mdata more complex but allows mdata tools/infrastructure to be less complex. (No input sanitization required, no behavior on illegal input needs to be defined, no second layer encoding is required ...)
= mdata is a format for keys and values
key = value
= mdata can be formatted prettily
book
author = Joseph Heller
title = Catch-22
= The combination of tags (key only records)
= and ordinary records
= allow for a very nice manual editing experience
= and just make sense for metadata.
cool =
= comments are a nice implication of the format ignoring empty keys
= comments can be indented, since keys are trimmed
= empty lines are also an implication
Above Mdata is equivalent to the following JSON:
{
"key": "value",
"book": "",
"author": "Joseph Heller",
"title": "Catch-22",
"cool": ""
}
Best practises, habits, conventions.
A rudimentary Go implementation can be found at https://gitlab.com/datasha.re/mdata.