Files
LASTA_DEV01\lasta 9e88f4c7ad ontology
2026-05-13 19:57:34 +09:00

27 lines
735 B
Python

from pathlib import Path
import mkdocs_gen_files
nav = mkdocs_gen_files.Nav()
pname = "ontocast"
for path in sorted(Path(pname).rglob("*.py")):
module_path = path.relative_to(pname).with_suffix("")
doc_path = path.relative_to(pname).with_suffix(".md")
full_doc_path = Path("reference", doc_path)
parts = list(module_path.parts)
if parts[-1] == "__init__":
parts = parts[:-1]
if not parts:
continue
parts_str: tuple[str, ...] = tuple(parts)
nav[parts_str] = str(full_doc_path)
with mkdocs_gen_files.open(full_doc_path, "w") as f:
ident = ".".join([pname] + parts)
f.write(f"# `{ident}`\n\n::: {ident}\n")
mkdocs_gen_files.set_edit_path(full_doc_path, path)