defunkt / pystache

Mustache in Python
http://mustache.github.com/
MIT License
1.31k stars 308 forks source link

[ADD] handlebars style helpers to pystache #178

Closed charbeljc closed 3 years ago

charbeljc commented 9 years ago

Use like this:

from pystache import handlebars
from operator import add
renderer = handlebars.Renderer()
renderer.register_helper('+', add)
print renderer.render("the sum of {{a}} and {{b}} is {{+ a b}}",
                      {'a': 1, 'b': 1})

If everything goes well, output should be:

the sum of 1 and 1 is 2

also change version to 0.5.4-handlebars to differenciate from upstream