From 9a9052e5bd06dd3ecafe263f9f5546435f12e616 Mon Sep 17 00:00:00 2001 From: jantwisted Date: Wed, 16 Dec 2015 01:51:13 +0530 Subject: comment added --- lps_gen.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lps_gen.py b/lps_gen.py index a7690b2..9476e75 100644 --- a/lps_gen.py +++ b/lps_gen.py @@ -133,15 +133,18 @@ class LPSMarkdown(Markdown): html = super(LPSMarkdown, self).parse(text) return lps_dict -def HTMLRender(_dict): - - templateLoader = jinja2.FileSystemLoader( searchpath="./" ) - templateEnv = jinja2.Environment( loader=templateLoader ) - TEMPLATE_FILE = "tests/files/index.html" - template = templateEnv.get_template( TEMPLATE_FILE ) - _data = {'res':_dict} - outputText = template.render( _data ) - return outputText +def HTMLRender(_dict): + """Render html from a dictionary and returns a string. + + Uses jinja2 and HTML template file. + """ + templateLoader = jinja2.FileSystemLoader( searchpath="./" ) + templateEnv = jinja2.Environment( loader=templateLoader ) + TEMPLATE_FILE = "tests/files/index.html" + template = templateEnv.get_template( TEMPLATE_FILE ) + _data = {'res':_dict} + lps_output = template.render( _data ) + return lps_output def main(): parser = ArgumentParser() -- cgit v1.2.3