()
| 215 | return epub_file |
| 216 | |
| 217 | def main() -> None: |
| 218 | parser = make_parser() |
| 219 | args = parser.parse_args(sys.argv[1:]) |
| 220 | |
| 221 | """Build ebooks.""" |
| 222 | with TemporaryDirectory() as raw_out_dir: |
| 223 | out_dir = Path(raw_out_dir) |
| 224 | |
| 225 | logging.info("converting svg images to png...") |
| 226 | converted_image_dir = convert_images( |
| 227 | Path("images"), out_dir / "converted_images" |
| 228 | ) |
| 229 | |
| 230 | languages = json.loads(Path("config.json").read_text())["languages"].keys() |
| 231 | logging.info(f"building ebooks for languages {'/'.join(languages)}") |
| 232 | |
| 233 | for lang in languages: |
| 234 | logging.info(f"{lang}: generating markdown...") |
| 235 | markdown_file = compile_full_markdown( |
| 236 | Path(lang), out_dir / f"{lang}.md", converted_image_dir |
| 237 | ) |
| 238 | |
| 239 | logging.info(f"{lang}: building pdf...") |
| 240 | pdf_file = build_pdf(markdown_file, out_dir / f"{lang}.pdf", args) |
| 241 | |
| 242 | logging.info(f"{lang}: building epub...") |
| 243 | epub_file = build_epub(markdown_file, out_dir / f"{lang}.epub") |
| 244 | |
| 245 | shutil.copy(pdf_file, f"ebook/vulkan_tutorial_{lang}.pdf") |
| 246 | shutil.copy(epub_file, f"ebook/vulkan_tutorial_{lang}.epub") |
| 247 | |
| 248 | logging.info("done") |
| 249 | |
| 250 | |
| 251 | if __name__ == "__main__": |
no test coverage detected