Converts ReStructuredText into JSON.
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
AUTHORS.rst
HISTORY.rst
LICENSE
MANIFEST.in
README.rst
sample.rst
sample2.rst
setup.py
simplicity.py
tests.py

README.rst

simplicity

Converts ReStructuredText into JSON.

  • Sections are JSON list dictionary elements
  • Section Headers become list titles.
  • Field definitions become key/value representations.
  • Directives are ignored.

Example

Input

Python
------
:age: 22
:typing: dynamic, strong

Java
----
:age: 18
:typing: static, strong

Output

[
    {"title": "Python", "age": 22, "typing": "dynamic, strong"}
    {"title": "Java", "age": 18, "typing": "static, strong"}
]

Usage

$ git clone git@github.com:pydanny/simplicity.git
$ cd simplicity/
$ python simplicity.py sample.rst
[
    {
        "description": "A fun programming language.\n\nUsed to build simplicity!",
        "title": "Python",
        "price": 0.0,
        "typing": "dynamic, strong",
        "age": 22,
        "mascot": "snake"
    },
    {
        "age": 18,
        "typing": "static, strong",
        "mascot": "???",
        "title": "Java"
    },
    {
        "url": "https://github.com",
        "mascot": "Octocat",
        "title": "GitHub"
    }
]

Best Used With

Simplicity is designed to be used with these packages:

  • Complexity: A refreshingly simple static site generator, for those who like to work in HTML.
  • redis-py: Redis Python Client

Know of any other good uses for Simplicity? Let me know and I'll add it to the list!

Examples