ontology
This commit is contained in:
26
ontology_platform/vendored/ontocast/docs/gen_pages.py
Normal file
26
ontology_platform/vendored/ontocast/docs/gen_pages.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user