lpschedule-generator

libreplanet schedule generator - ricketyspace.net/lpschedule-generator
git clone git://git.ricketyspace.net/lpschedule-generator.git
Log | Files | Refs

commit 9a9052e5bd06dd3ecafe263f9f5546435f12e616
parent 01997af8b0c04318c2c76afc29eb043052e3d793
Author: jantwisted <janith@member.fsf.org>
Date:   Wed, 16 Dec 2015 01:51:13 +0530

comment added

Diffstat:
lps_gen.py | 21++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)

diff --git 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()