Pi66

merodi
A markdown-based static site generator.
git clone https://git.pi66.xyz/merodi

← back to log

fix: simplify reload()

author: pi66
date: 2026-07-03 19:44
hash: 0abf12acf7b5977ff88886ce5e2db97b6662f9d6

Diffstat:

M

src/watcher.py
7 +++++++++++++-----------------
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
diff --git a/src/watcher.py b/src/watcher.py
index d62b98d..c3e2127 100644
--- a/src/watcher.py
+++ b/src/watcher.py
@@ -19,11 +19,10 @@ def reload(changed_path, tree_config, extras_config):
             return None

         md_relpath = path.relpath(current_md_file, tree_config.markdown)
-        dest = path.join(tree_config.dest, md_relpath)
-        dest = dest.removesuffix(".md") + ".html"
-        url = path.relpath(dest, tree_config.dest)
+        html = path.splitext(md_relpath)[0] + ".html"
+        dest = path.join(tree_config.dest, html)
         compile_md_to_html(current_md_file, dest, tree_config, extras_config)
-        return url
+        return html
     except Exception as e:
         warn(str(e))