Pi66

Home | Repos | About | Blog | Gaza

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

About | Files | Commits | Refs | License


fix: resolve symlinked markdown files using readlink before compiling

Author: pi66
Date: 2026-07-05 01:19
commit: b900af2e

Stat

M src/build.py 5 +3 -2

Diff

diff --git a/src/build.py b/src/build.py
index fb72e7e..349bf4e 100644
--- a/src/build.py
+++ b/src/build.py
@@ -6,7 +6,7 @@ from . import settings
 from jinja2 import Environment, FileSystemLoader
 from markdown import markdown
 from markdown.extensions.attr_list import AttrListTreeprocessor
-from os import chdir, getcwd, makedirs, path, walk
+from os import chdir, getcwd, makedirs, path, walk, readlink
 from os.path import abspath, dirname

from .config import find_project_from_path, load_config @@ -173,7 +173,8 @@ def build(building_type:str,project_path:str, file:list[str]): md_file = path.join(parent, filename) md_relpath = path.relpath(md_file,md_path) html_dest = path.join(config.tree.dest, md_relpath).removesuffix(".md") + ".html" - compile_md_to_html(md_file, html_dest) + source_file = readlink(md_file) if path.islink(md_file) else md_file + compile_md_to_html(source_file, html_dest) ...

Show all

diff --git a/src/build.py b/src/build.py
index fb72e7e..349bf4e 100644
--- a/src/build.py
+++ b/src/build.py
@@ -6,7 +6,7 @@ from . import settings
 from jinja2 import Environment, FileSystemLoader
 from markdown import markdown
 from markdown.extensions.attr_list import AttrListTreeprocessor
-from os import chdir, getcwd, makedirs, path, walk
+from os import chdir, getcwd, makedirs, path, walk, readlink
 from os.path import abspath, dirname

from .config import find_project_from_path, load_config @@ -173,7 +173,8 @@ def build(building_type:str,project_path:str, file:list[str]): md_file = path.join(parent, filename) md_relpath = path.relpath(md_file,md_path) html_dest = path.join(config.tree.dest, md_relpath).removesuffix(".md") + ".html" - compile_md_to_html(md_file, html_dest) + source_file = readlink(md_file) if path.islink(md_file) else md_file + compile_md_to_html(source_file, html_dest)

 except Exception as e:
     fatal(e, f"Build failed: {e}")

// Created by Pi66

// Copyright ©Pi66 2026