From 3de89cdc68ee985b15219ef92d26e5bfdb062f8a Mon Sep 17 00:00:00 2001 From: Guy Godfroy Date: Sun, 6 Dec 2020 15:23:48 +0100 Subject: [PATCH] make posts content available for templates --- geminer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/geminer.py b/geminer.py index 756ff9f..2bfb603 100755 --- a/geminer.py +++ b/geminer.py @@ -136,19 +136,22 @@ for dirname, subdirlist, mdlist in os.walk("."): table_tag=config.table_tag, ) + post["content"] = gmitext + # Read template file with open(tpl_path + "/" + post["template"] + ".tpl", "r") as tpl: template = Template(tpl.read()) # Integrate the GMI content in the template - gmitext = template.render(content=gmitext, meta=post) + rendered_text = template.render(post=post) # Dirty fix a weird bug where some lines are CRLF-terminated - gmitext = gmitext.replace("\r\n", "\n") + rendered_text = gmitext.replace("\r\n", "\n") + # Time to write the GMI file with open(gmi_subpath + "/" + gmifile, "w") as gmi: - gmi.write(gmitext) + gmi.write(rendered_text) # Generate home page with open(tpl_path + "/index.tpl", "r") as tpl: