Introduction
With pybars3, this library allow moban users to have handlebars template in their next documentation endeavour.
Quick start
$ moban "<p>{{firstname}} {{lastname}}</p>" --template-type handlebars -d firstname=hello lastname=world
Nested input objects
Given a data.json file with the following content
{
"person": {
"firstname": "Yehuda",
"lastname": "Katz",
},
}
$ moban --template-type handlebars -c data.json "{{person.firstname}} {{person.lastname}}"
Handlebars-ing <p>{{first... to moban.output
Handlebarsed 1 file.
$ cat moban.output
Yehuda Katz
For handlebars.js users, yes, the example was copied from handlebarjs.com. The aim is to show off what we can do.
Let’s continue with a bit more fancy feature:
$ moban --template-type handlebars -c data.json "{{#with person}}{{firstname}} {{lastname}} {{/with}}"
Moban’s way of pybar3 usage:
Let’s save the following file a script.py under helper_and_partial folder:
from moban_handlebars.api import Helper, register_partial
register_partial('header', '<h1>People</h1>')
@Helper('list')
def _list(this, options, items):
result = [u'<ul>']
for thing in items:
result.append(u'<li>')
result.extend(options['fn'](thing))
result.append(u'</li>')
result.append(u'</ul>')
return result
And given data.json reads as the following:
{
"people":[
{"name": "Bill", "age": 100},
{"name": "Bob", "age": 90},
{"name": "Mark", "age": 25}
]
}
Let’s invoke handlebar template:
$ moban --template-type hbs -pd helper_and_partial -c data.json "{{>header}}{{#list people}}{{name}} {{age}}{{/list}}"
Handlebars-ing {{>header}... to moban.output
Handlebarsed 1 file.
$ cat moban.output
<h1>People</h1><ul><li>Bill 100</li><li>Bob 90</li><li>Mark 25</li></ul>
Installation
You can install moban-handlebars via pip:
$ pip install moban-handlebars
or clone it and install it:
$ git clone https://github.com/moremoban/moban-handlebars.git
$ cd moban-handlebars
$ python setup.py install
Contributors
In alphabetical order:
Change log
0.0.5 - 07.06.2020
Updated
Name the moban actions when this template is used
#12: provide apis for end user to use their own block helper and partials
0.0.4 - 14.10.2019
Updated
#10: support moban v6.5
0.0.3 - 10.09.2019
Updated
0.0.2 - 22-01-2019
Updated
0.0.1 - 18-11-2018
First release
render .hbr .handlebars files for moban
Metadata
Release files for moban-handlebars 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moban-handlebars-0.0.5.tar.gz | 11.7 kB | Without provenance | Details for moban-handlebars-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moban_handlebars-0.0.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for moban_handlebars-0.0.5-py2.py3-none-any.whl |
Total release size: 17.7 kB
Release files / moban-handlebars-0.0.5.tar.gz
| Download URL | moban-handlebars-0.0.5.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
10e900b5a82e29e3df6cd628537213eb786a96bb122ade3193247e5e6c0c0ac1
|
|
BLAKE2b-256 checksum How to use checksums |
74313e3f999081153d0683a86dffbfb1a90714234dbaed53b5b4fb7d15d864ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / moban_handlebars-0.0.5-py2.py3-none-any.whl
| Download URL | moban_handlebars-0.0.5-py2.py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
03e59cbf3c2226095b78bafc486e4439aff31e4976256d0ad8de831e34308217
|
|
BLAKE2b-256 checksum How to use checksums |
555c33ddedb27f2c252336fad7c694fd1511fd8bbf7ad82d7d8beb4d275a36d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Security for moban-handlebars 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.