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

Function _render_page

scripts/docs/generate_rust_library_reference.py:565–587  ·  view source on GitHub ↗
(page: Page, pages_by_html: dict[Path, Page], position: int)

Source from the content-addressed store, hash-verified

563
564
565def _render_page(page: Page, pages_by_html: dict[Path, Page], position: int) -> str:
566 soup = BeautifulSoup(page.html_path.read_text(encoding="utf-8"), "html.parser")
567 content = soup.select_one("#main-content")
568 if content is None:
569 raise SystemExit(f"rustdoc main content not found: {page.html_path}")
570 _remove_noisy_sections(content)
571
572 body = _remove_duplicate_top_level_sections(_block_markdown(content, page, pages_by_html).strip())
573 description = _description(soup)
574 lines = [
575 frontmatter(
576 _page_title(soup, page),
577 description,
578 position,
579 sidebar_title=_sidebar_title(soup, page),
580 slug=page.url if _needs_explicit_slug(page) else None,
581 normalize=_ascii,
582 ),
583 ]
584 lines.append(f"{GENERATED_BY}\n\n")
585 if body:
586 lines.append(body + "\n")
587 return "".join(lines)
588
589
590def _item_order(index_html: Path, pages_by_html: dict[Path, Page]) -> dict[Path, int]:

Callers 1

generateFunction · 0.85

Calls 9

frontmatterFunction · 0.90
_remove_noisy_sectionsFunction · 0.85
_block_markdownFunction · 0.85
_descriptionFunction · 0.85
_page_titleFunction · 0.85
_sidebar_titleFunction · 0.85
_needs_explicit_slugFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected