From acae10d185732de396795af69b498615eb382009 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 17 Feb 2025 18:03:03 +0100 Subject: [PATCH] refactor --- publish.py | 43 +++++++++++++++++++++++++--------------- settings.yml.sample.yaml | 6 +++--- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/publish.py b/publish.py index 656bd00..3636141 100644 --- a/publish.py +++ b/publish.py @@ -18,6 +18,8 @@ htmltemplate = """ {body}""" +settingsfile = "../textes/settings.yml" + def apply_html_template(body, title): return htmltemplate.format(body=body, title=title) @@ -32,7 +34,7 @@ def md2gmi(md): gmi = re.sub(r'\*(.*)\*', r'\1', gmi) return gmi -with open("settings.yml", "r", encoding="utf-8") as file: +with open(settingsfile, "r", encoding="utf-8") as file: index = yaml.safe_load(file) htmlhome = "

{}

{}

".format(index['title'], index['description']) @@ -42,12 +44,21 @@ os.makedirs("out/html", exist_ok=True) os.makedirs("out/gmi", exist_ok=True) for folderinfo in index['folders']: - htmlhome += "\n

{}

\n