Created
April 18, 2014 01:56
-
-
Save val314159/11021008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from staching import Stache | |
class Stache2(Stache): | |
def add_template_file(s, name,prefix): | |
s.add_template(name, ''.join(open(prefix+name).xreadlines())) | |
def load_templates(s, prefix): | |
[ s.add_template_file(fn,prefix) for fn in os.listdir(prefix) ] | |
if __name__=='__main__': | |
from sys import argv | |
from json import load | |
s = Stache2() | |
s.load_templates('tmpl/') | |
print s.render_template(argv[1],load(open(argv[2]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment