From: noah morrison Date: Wed, 12 Nov 2014 15:11:43 +0000 (-0500) Subject: Added complete unpacking ability to render X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=7f0e7a059d7f79eb8a4bbb9e68716498d0071a00;p=chevron.git Added complete unpacking ability to render All of renders args are now KWargs --- diff --git a/entei.py b/entei.py index 8d1e9f4..0958f3e 100755 --- a/entei.py +++ b/entei.py @@ -146,7 +146,7 @@ def tokenize(template): raise UnclosedSection() -def render(template, data, partials_path='.', partials_ext='mustache', +def render(template='', data={}, partials_path='.', partials_ext='mustache', partials_dict={}, padding=0): """Render a mustache template. @@ -298,8 +298,10 @@ def render(template, data, partials_path='.', partials_ext='mustache', return output if __name__ == '__main__': - data = argv[1] - template = argv[2] + args = { + 'template': open(argv[2], 'r'), + 'data': json.load(open(argv[1], 'r')), + } - output = render(open(template, 'r'), json.load(open(data, 'r'))) + output = render(**args) print(output)