From 01997af8b0c04318c2c76afc29eb043052e3d793 Mon Sep 17 00:00:00 2001 From: jantwisted Date: Wed, 16 Dec 2015 01:39:41 +0530 Subject: HTMLRender added --- lps_gen.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lps_gen.py') diff --git a/lps_gen.py b/lps_gen.py index 657b030..a7690b2 100644 --- a/lps_gen.py +++ b/lps_gen.py @@ -19,6 +19,7 @@ # . import json +import jinja2 from argparse import ArgumentParser from collections import OrderedDict @@ -132,6 +133,15 @@ 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 main(): parser = ArgumentParser() @@ -143,8 +153,9 @@ def main(): markdown = LPSMarkdown() lps_dict = markdown(lps_md_content) + print HTMLRender(lps_dict) - print json.dumps(lps_dict, indent=4) + #print json.dumps(lps_dict, indent=4) if __name__ == "__main__": -- cgit v1.2.3