MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / _url_relative

Function _url_relative

scripts/docs/generate_rust_library_reference.py:178–185  ·  view source on GitHub ↗
(crate_name: str, crate_dir: Path, html_path: Path)

Source from the content-addressed store, hash-verified

176
177
178def _url_relative(crate_name: str, crate_dir: Path, html_path: Path) -> Path:
179 crate_slug = _crate_slug(crate_name)
180 rel = html_path.relative_to(crate_dir)
181 parent_parts = [_rustdoc_path_part(part) for part in rel.parent.parts]
182 if rel.name == "index.html":
183 return Path(crate_slug, *parent_parts, "index.mdx")
184 stem = rel.name.removesuffix(".html")
185 return Path(crate_slug, *parent_parts, f"{_slug_part(stem)}.mdx")
186
187
188def _page_url(output_rel: Path) -> str:

Callers 1

_discover_pagesFunction · 0.85

Calls 3

_crate_slugFunction · 0.85
_rustdoc_path_partFunction · 0.85
_slug_partFunction · 0.70

Tested by

no test coverage detected