fix path stuff

This commit is contained in:
Guy Godfroy 2020-12-08 16:50:41 +01:00
parent 1616348651
commit 578a8408a4
1 changed files with 4 additions and 2 deletions

View File

@ -149,15 +149,17 @@ for dirname, subdirlist, mdlist in os.walk(md_path):
# Generate custom extra pages # Generate custom extra pages
for page_dict in config.custom_pages: for page_dict in config.custom_pages:
rel_path, filename = os.path.split(page_dict["name"]) rel_path, filename = os.path.split(page_dict["name"])
if rel_path:
os.makedirs(rel_path, exist_ok=True) os.makedirs(rel_path, exist_ok=True)
basename, extension = os.path.spolitext(page_dict["name"]) basename, extension = os.path.spolitext(page_dict["name"])
if not extension: if not extension:
extention = gmi_extension extention = gmi_extension
filename = basename + extension filename = basename + extension
filepath = os.path.join(rel_path, filename)
with open(tpm_path + "/" + page_dict.get("tpl", basename) + ".tpl", "r") as tpl: with open(tpm_path + "/" + page_dict.get("tpl", basename) + ".tpl", "r") as tpl:
template = Template(tpl.read()) template = Template(tpl.read())
text = template.render(posts=posts) text = template.render(posts=posts)
with open(gmi_path + rel_path + "/" + filename, "w") as gmi: with open(gmi_path + filepath, "w") as gmi:
gmi.write(text) gmi.write(text)
# Generate custom meta pages # Generate custom meta pages