Metadata-Version: 2.1
Name: ustache
Version: 0.1.0
Summary: ustache, Mustache for Python
Home-page: https://gitlab.com/ergoithz/ustache
Author: Felipe A Hernandez
Author-email: ergoithz@gmail.com
License: MIT
Keywords: template,mustache
Platform: any
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown
Provides-Extra: codestyle
Requires-Dist: flake8 ; extra == 'codestyle'
Requires-Dist: flake8-blind-except ; extra == 'codestyle'
Requires-Dist: flake8-bugbear ; extra == 'codestyle'
Requires-Dist: flake8-builtins ; extra == 'codestyle'
Requires-Dist: flake8-commas ; extra == 'codestyle'
Requires-Dist: flake8-docstrings ; extra == 'codestyle'
Requires-Dist: flake8-import-order ; extra == 'codestyle'
Requires-Dist: flake8-logging-format ; extra == 'codestyle'
Requires-Dist: flake8-rst-docstrings ; extra == 'codestyle'
Provides-Extra: coverage
Requires-Dist: coverage ; extra == 'coverage'
Provides-Extra: docs
Requires-Dist: recommonmark ; extra == 'docs'
Requires-Dist: sphinx ; extra == 'docs'
Provides-Extra: release
Requires-Dist: wheel ; extra == 'release'
Requires-Dist: twine ; extra == 'release'
Provides-Extra: tests
Requires-Dist: coverage ; extra == 'tests'

# ustache

Mustache for Python.

Documentation: [ustache.readthedocs.io](https://ustache.readthedocs.io)

## Usage

```python
import ustache

print(ustache.render('Hello {{v}}', {'v': 'World!'}))
# Hello World!
```

Command line:

```console
$ ustache -j data.json -o output.html template.mustache
```

## Highlights

- Command line interface.
- Spec compliant, but also highly compatible with `Mustache.js`.
- Fast and small codebase, efficiently rendering to str or bytes,
  supporting streaming.
- Customizable (property getter, partial resolver, and stringify, escape
  and lambda render functions).

## Considerations

For inter-compatibility with JavaScript (enabling client-side rendering with
the same templates), ustache made some deliberate behavior choices:

- Mustache blocks stick to JavaScript falseness (`__bool__` is not honored):
  `None`, `False`, `0`, `nan`, and empty sequences (including strings)
  are taken as falsy, while everything else (including empty mappings) will
  be considered truthy (Mustache.js `Boolean` and empty `Array` handling).
- Mustache blocks receiving any iterable other than mappings and strings
  will result on a loop (Mustache.js `Array` handling).
- Sequences expose a virtual `length` property
  (JavaScript `Array.length` emulation).
- Sequence elements are accessible by positive index in the same way mapping
  integer-keyed items are also accessible if no string key conflicts, as
  properties (JavaScript `Object` emulation).

## Syntax

Check out the [mustache(5) manual](https://mustache.github.io/mustache.5.html).

For quick reference, here is a quick overview of the Mustache syntax.

Template:
```mustache
{{!comment}}
<ul>
{{#object}}<li>{{property}}</li>{{/object}}
{{^object}}<li>As <b>object</b> is truthy, this won't be shown</li>{{/object}}
{{^null}}<li><b>null</b> is falsy</li>{{/null}}
{{#array}}<li>{{property}}</li>
{{/array}}
{{^array}}<li>Array isn't empty, this won't be shown.</li>{{/array}}
{{#empty_array}}<li>Empty Array, this won't be shown</li>{{/empty_array}}
{{^empty_array}}<li>empty_array is empty</li>{{/empty_array}}
{{&unescaped_html}}
</ul>
```

Data:
```json
{
  "object": {
    "property": "Object property value"
  },
  "null": null,
  "array": [
    {"property": "Array item1 property"},
    {"property": "Array item2 property"},
    {"property": "Array item3 property"}
  ],
  "empty_array": [],
  "unescaped_html": "<li>this is unescaped html</li>"
}
```

Output:
```html
<ul>
<li>Object property value</li>
<li><b>null</b> is falsy</li>
<li>Array item1 property</li>
<li>Array item2 property</li>
<li>Array item3 property</li>
<li>empty_array is empty</li>
<li>this is unescaped html</li>
</ul>
```


