Gen ref pages
In [ ]:
Copied!
"""Generate the code reference pages."""
"""Generate the code reference pages."""
In [ ]:
Copied!
from pathlib import Path
from pathlib import Path
In [ ]:
Copied!
import mkdocs_gen_files
import mkdocs_gen_files
In [ ]:
Copied!
nav = mkdocs_gen_files.Nav()
nav = mkdocs_gen_files.Nav()
In [ ]:
Copied!
for path in sorted(Path("rul_datasets").rglob("*.py")):
module_path = path.with_suffix("")
doc_path = path.with_suffix(".md")
full_doc_path = Path("api", doc_path)
parts = list(module_path.parts)
if parts[-1] == "__init__":
parts = parts[:-1]
doc_path = doc_path.with_name("index.md")
full_doc_path = full_doc_path.with_name("index.md")
elif parts[-1] == "__main__":
continue
if len(parts) > 1:
nav[parts[1:]] = doc_path.as_posix()
with mkdocs_gen_files.open(full_doc_path, mode="wt") as fd:
identifier = ".".join(parts)
print("::: " + identifier, file=fd)
mkdocs_gen_files.set_edit_path(full_doc_path, Path("../") / path)
for path in sorted(Path("rul_datasets").rglob("*.py")):
module_path = path.with_suffix("")
doc_path = path.with_suffix(".md")
full_doc_path = Path("api", doc_path)
parts = list(module_path.parts)
if parts[-1] == "__init__":
parts = parts[:-1]
doc_path = doc_path.with_name("index.md")
full_doc_path = full_doc_path.with_name("index.md")
elif parts[-1] == "__main__":
continue
if len(parts) > 1:
nav[parts[1:]] = doc_path.as_posix()
with mkdocs_gen_files.open(full_doc_path, mode="wt") as fd:
identifier = ".".join(parts)
print("::: " + identifier, file=fd)
mkdocs_gen_files.set_edit_path(full_doc_path, Path("../") / path)
In [ ]:
Copied!
with mkdocs_gen_files.open("api/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
with mkdocs_gen_files.open("api/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())