diff options
author | jantwisted <janith@member.fsf.org> | 2015-12-16 01:39:41 +0530 |
---|---|---|
committer | jantwisted <janith@member.fsf.org> | 2015-12-16 01:39:41 +0530 |
commit | 01997af8b0c04318c2c76afc29eb043052e3d793 (patch) | |
tree | 6d5b36f1c28ed03d94c153e8102bb166042cb419 /lps_gen.py | |
parent | 911fd27e4c4c61b978c2370f7e92b051f0636614 (diff) |
HTMLRender added
Diffstat (limited to 'lps_gen.py')
-rw-r--r-- | lps_gen.py | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -19,6 +19,7 @@ # <http://www.gnu.org/licenses/>. 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__": |