-
-
Notifications
You must be signed in to change notification settings - Fork 84
Serialized Conversion
As described in the Background section of legacy syntax definitions, TextMate used the Property List format for all of its resource files. Because hand-editing XML is annoying, functionality for converting between Property Lists, JSON and YAML has been added to PackageDev.
The functionality was primarily intended for syntax definitions, but it can be used for color schemes and TextMate Preferences files alike. Even JSON files like menus can be converted to or from YAML.
The "Convert to..." build system can interchangably convert JSON, YAML and Property List files. The source format is automatically detected where possible, and you will then be prompted for the target file's format.
By default, the target file's extension is determined by the following rules:
-
I am json.json
is converted intoI am json.plist
or.yaml
, depending on the target format. -
I am json.JSON-propertyList
(or.YAML-propertyList
) is converted intoI am json.propertyList
regardless of the target format.
Both, the target format and the extension, can be configured on a per-file basis by an options comment in the first three lines (usually the first, except for XML-based Property Lists).
An options comment consists of
- a comment start marker,
- the sequence
[PackageDev]
followed by whitespace - a YAML flow mapping without surrounding curly braces (
{}
) - a comment end marker (optional).
Currently supported options (keys) are:
-
target_format
- expected values: plist, yaml or json -
ext
- the target extension without leading.
Example (YAML):
# [PackageDev] target_format: plist, ext: tmLanguage
Example (JSON):
// [PackageDev] target_format: plist, ext: tmLanguage