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

Function _page_title

scripts/docs/generate_rust_library_reference.py:501–514  ·  view source on GitHub ↗
(soup: BeautifulSoup, page: Page)

Source from the content-addressed store, hash-verified

499
500
501def _page_title(soup: BeautifulSoup, page: Page) -> str:
502 h1 = soup.select_one("#main-content .main-heading h1")
503 if h1 is not None:
504 title = _heading_text(h1)
505 title = re.sub(
506 r"^(Crate|Module|Function|Struct|Enum|Trait|Type Alias|Constant|Macro)(?=\S)",
507 r"\1 ",
508 title,
509 )
510 title = re.sub(r"\s+", " ", title)
511 if title.startswith("Crate "):
512 return page.crate_name
513 return title
514 return page.crate_name
515
516
517def _remove_duplicate_top_level_sections(markdown: str) -> str:

Callers 1

_render_pageFunction · 0.85

Calls 1

_heading_textFunction · 0.85

Tested by

no test coverage detected