(soup: BeautifulSoup, page: Page)
| 536 | |
| 537 | |
| 538 | def _sidebar_title(soup: BeautifulSoup, page: Page) -> str: |
| 539 | topbar = soup.select_one("rustdoc-topbar h2") |
| 540 | if topbar is not None: |
| 541 | text = _clean_text(topbar.get_text("", strip=True)) |
| 542 | if text: |
| 543 | if text.startswith("Crate "): |
| 544 | return page.crate_name |
| 545 | if text.startswith("Module "): |
| 546 | return text.removeprefix("Module ") |
| 547 | return text |
| 548 | if page.output_path.name == "index.mdx": |
| 549 | return page.output_path.parent.name |
| 550 | return page.output_path.stem |
| 551 | |
| 552 | |
| 553 | def _description(soup: BeautifulSoup) -> str: |
no test coverage detected