From d8b539a9f2a18369400444ada72dff4a83595bab Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 3 Oct 2015 12:41:21 +0300 Subject: Use jinja2 for templates --- jtlib/app.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'jtlib/app.py') diff --git a/jtlib/app.py b/jtlib/app.py index 4b0c54e..6e33646 100644 --- a/jtlib/app.py +++ b/jtlib/app.py @@ -18,6 +18,8 @@ import cliapp import os import time +import jinja2 + import jtlib @@ -106,3 +108,8 @@ class JournalTool(cliapp.Application): if os.path.exists(filename): with open(filename) as f: return f.read() + + def render_template(self, basename, vars): + text = self.read_template(basename) + template = jinja2.Template(text) + return template.render(**vars) -- cgit v1.2.1