Skip to content

Commit

Permalink
Add navigation elements to gen_reg_pages.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kabilar committed Jan 16, 2025
1 parent a3fc412 commit 20f88cc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/scripts/gen_ref_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
root = Path(__file__).parent.parent.parent
src = root / "linc_convert"

nav['Welcome']='index.md'
nav['Contribute']='contribute.md'
nav['About']='about.md'

for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
doc_path = "api" / path.relative_to(src).with_suffix(".md")
full_doc_path = Path(root, "docs", doc_path)
module_path = path.relative_to(src).with_suffix("")
parts = tuple(module_path.parts)

if parts[-1] == "__init__":
Expand All @@ -21,7 +25,8 @@
continue

if parts:
nav[parts] = Path(doc_path).as_posix()
parts_modified = ('API',) + parts
nav[parts_modified] = Path(doc_path).as_posix()
with mkdocs_gen_files.open(full_doc_path, "w") as fd:
ident = ".".join(parts)
fd.write(f"::: linc_convert.{ident}")
Expand Down

0 comments on commit 20f88cc

Please sign in to comment.