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

Function _discover_pages

scripts/docs/generate_rust_library_reference.py:201–221  ·  view source on GitHub ↗
(doc_root: Path, output_dir: Path)

Source from the content-addressed store, hash-verified

199
200
201def _discover_pages(doc_root: Path, output_dir: Path) -> dict[Path, Page]:
202 pages: dict[Path, Page] = {}
203 for crate_name, crate_dir_name, _description in CRATES:
204 crate_dir = doc_root / crate_dir_name
205 if not crate_dir.is_dir():
206 raise SystemExit(f"rustdoc crate output not found: {crate_dir}")
207 for html_path in sorted(crate_dir.rglob("*.html")):
208 if html_path.name == "all.html":
209 continue
210 if 'id="main-content"' not in html_path.read_text(encoding="utf-8", errors="ignore"):
211 continue
212 output_rel = _output_relative(crate_name, crate_dir, html_path)
213 url_rel = _url_relative(crate_name, crate_dir, html_path)
214 pages[html_path.resolve()] = Page(
215 html_path=html_path.resolve(),
216 output_path=output_dir / output_rel,
217 url=_page_url(url_rel),
218 crate_name=crate_name,
219 crate_dir_name=crate_dir_name,
220 )
221 return pages
222
223
224def _resolve_href(page: Page, href: str, pages_by_html: dict[Path, Page]) -> str | None:

Callers 1

generateFunction · 0.85

Calls 5

_output_relativeFunction · 0.85
_url_relativeFunction · 0.85
PageClass · 0.85
_page_urlFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected