(soup: BeautifulSoup, page: Page)
| 499 | |
| 500 | |
| 501 | def _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 | |
| 517 | def _remove_duplicate_top_level_sections(markdown: str) -> str: |
no test coverage detected