Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zen_markup_lang-0.1.0.tar.gz (48.5 kB view hashes)

Uploaded Source

Built Distribution

zen_markup_lang-0.1.0-py3-none-any.whl (49.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page