Read and write files in Zen Markup Language.
Project description
Introduction
Zen Markup Language is a markup language designed to store application configs. It combines the advantages of JSON, XML and YAML.
- ZML can store any JSON object.
- ZML keeps high readlibility even with deep nested structure like XML.
- ZML has a XML-like syntax, but is as user-frendly as YAML.
- ZML doesn't rely on indentation like JSON and XML.
Installation
Just run this command.
pip install zen-markup-lang
Quick Start
Syntax
The syntax of ZML is very intuitive. The follwing example demostrates basic ZML syntax.
<!zml 0.1>
<a> 114514 </a>
<b> 1919.810 </b>
<c> true </c>
<d> false </d>
<e> null </e>
<f>
<> "hello`t" </>
<> "world!" </>
</f>
<g> empty_obj </g>
<h>
<i> empty_arr </i>
</h>
The ZML file above is equivalent to the following JSON object:
{
"a": 114514,
"b": 1919.810,
"c": true,
"d": false,
"e": null,
"f": ["hello\t", "world!"],
"g": {},
"h": {
"i": []
}
}
A major difference is that the escaping character in ZML is ` instead of common \ .
Use ZML in Python
The package is named zen_markup_lang
. You can import the package like
import zen_markup_lang as zml
There are four functions in the package, load
, loads
, dump
and dumps
. They are similar to the functions in Python standard library json
.
with open('a.zml') as f:
d = zml.load(f)
print(zml.dumps(d))
That's all. Enjoy! 👏
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for zen_markup_lang-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcb517399cefea6f80b05c96300c2fae26620c6befc48a3413d0fda60e5f28a6 |
|
MD5 | 372cc6a67709f8a1655ad5e9f07a095f |
|
BLAKE2b-256 | cb1714bc6bf94c1bc0d7e0466628cac57c0545a52f88dbaffa4d2769b9d75b05 |