(repo_root: Path, doc_root: Path, output_dir: Path, *, run_cargo_doc: bool)
| 635 | |
| 636 | |
| 637 | def generate(repo_root: Path, doc_root: Path, output_dir: Path, *, run_cargo_doc: bool) -> int: |
| 638 | if run_cargo_doc: |
| 639 | _run_cargo_doc(repo_root) |
| 640 | pages_by_html = _discover_pages(doc_root, output_dir) |
| 641 | positions = _positions(pages_by_html, doc_root) |
| 642 | |
| 643 | reset_output_dir(output_dir) |
| 644 | _write_index(output_dir) |
| 645 | |
| 646 | for index, page in enumerate(sorted(pages_by_html.values(), key=lambda page: page.output_path.as_posix()), start=1): |
| 647 | page.output_path.parent.mkdir(parents=True, exist_ok=True) |
| 648 | position = positions.get(page.html_path, index) |
| 649 | page.output_path.write_text(_render_page(page, pages_by_html, position), encoding="utf-8") |
| 650 | |
| 651 | return len(pages_by_html) |
| 652 | |
| 653 | |
| 654 | def main() -> None: |
no test coverage detected