| 478 | |
| 479 | |
| 480 | def _write_review_page( |
| 481 | path: Path, |
| 482 | *, |
| 483 | title: str, |
| 484 | source_path: str, |
| 485 | label: str, |
| 486 | fragment_html: str, |
| 487 | ) -> None: |
| 488 | del source_path, label # diff index already shows path + which side this is |
| 489 | path.write_text( |
| 490 | f"""<!doctype html> |
| 491 | <html lang=\"en\"> |
| 492 | <head> |
| 493 | <meta charset=\"utf-8\"> |
| 494 | <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> |
| 495 | <title>{html_escape(title)}</title> |
| 496 | <style> |
| 497 | body {{ |
| 498 | margin: 0; |
| 499 | background: #fff; |
| 500 | color: #111; |
| 501 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; |
| 502 | line-height: 1.5; |
| 503 | }} |
| 504 | main {{ max-width: 980px; margin: 0 auto; padding: 24px; }} |
| 505 | pre, code {{ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }} |
| 506 | pre {{ overflow-x: auto; background: #f6f8fa; padding: 12px; border-radius: 4px; }} |
| 507 | code {{ background: #f6f8fa; padding: 1px 4px; border-radius: 3px; }} |
| 508 | pre code {{ background: none; padding: 0; }} |
| 509 | table {{ border-collapse: collapse; }} |
| 510 | td, th {{ border: 1px solid #e5e7eb; padding: 4px 8px; }} |
| 511 | </style> |
| 512 | </head> |
| 513 | <body> |
| 514 | <main> |
| 515 | {fragment_html} |
| 516 | </main> |
| 517 | </body> |
| 518 | </html> |
| 519 | """ |
| 520 | ) |
| 521 | |
| 522 | |
| 523 | _CLIP_HEIGHT = 12000 |