Skip to main content

Provide handlebars templating capability to moban.

Project description


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 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 under helper_and_partial folder:

from moban_handlebars.api import Helper, register_partial

register_partial('header', '<h1>People</h1>')

def _list(this, options, items):
    result = [u'<ul>']
    for thing in items:
    return result

And given data.json reads as the following:

        {"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>


You can install moban-handlebars via pip:

$ pip install moban-handlebars

or clone it and install it:

$ git clone
$ cd moban-handlebars
$ python install


Charlie Liu


In alphabetical order:

Change log

0.0.5 - 07.06.2020


  1. Name the moban actions when this template is used

  2. #12: provide apis for end user to use their own block helper and partials

0.0.4 - 14.10.2019


  1. #10: support moban v6.5

0.0.3 - 10.09.2019


  1. #7: support moban v4.1

  2. #9: support moban v6

0.0.2 - 22-01-2019


  1. #1: support moban v0.3.8

  2. #2: add license file

  3. #3: support moban v0.3.9

0.0.1 - 18-11-2018

First release

  1. render .hbr .handlebars files for moban

Download files

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

Source Distribution

moban-handlebars-0.0.5.tar.gz (11.7 kB view hashes)

Uploaded source

Built Distribution

moban_handlebars-0.0.5-py2.py3-none-any.whl (6.0 kB view hashes)

Uploaded py2 py3

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