Function
build_epub
(markdown_file: Path, epub_file: Path)
Source from the content-addressed store, hash-verified
| 196 | |
| 197 | |
| 198 | def build_epub(markdown_file: Path, epub_file: Path) -> Path: |
| 199 | try: |
| 200 | subprocess.check_output( |
| 201 | [ |
| 202 | "pandoc", |
| 203 | markdown_file.as_posix(), |
| 204 | "--toc", |
| 205 | "-o", |
| 206 | epub_file.as_posix(), |
| 207 | "--epub-cover-image=ebook/cover.png", |
| 208 | ] |
| 209 | ) |
| 210 | except CalledProcessError as e: |
| 211 | raise RuntimeError( |
| 212 | f"failed to build {epub_file}: pandoc failed: {e.output.decode()}" |
| 213 | ) |
| 214 | |
| 215 | return epub_file |
| 216 | |
| 217 | def main() -> None: |
| 218 | parser = make_parser() |
Tested by
no test coverage detected