(path: Path)
| 115 | |
| 116 | |
| 117 | def title_from_markdown(path: Path) -> str: |
| 118 | for line in path.read_text(encoding="utf-8").splitlines(): |
| 119 | match = re.match(r"^#\s+(.+?)\s*$", line) |
| 120 | if match: |
| 121 | return match.group(1).strip() |
| 122 | return path.stem |
| 123 | |
| 124 | |
| 125 | def english_title(title: str) -> str: |