From d08c0023c9cf508cc7f6d0e2555de50917ca2fa4 Mon Sep 17 00:00:00 2001 From: TheManchineel <37479927+TheManchineel@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:29:30 +0100 Subject: [PATCH] build: make doc builds concurrent --- build_docs_v2.py | 61 ++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/build_docs_v2.py b/build_docs_v2.py index a282216..689103e 100644 --- a/build_docs_v2.py +++ b/build_docs_v2.py @@ -6,34 +6,40 @@ def build_docs_and_index(): + jobs = [] with StringIO() as index_entries: - for path in pathlib.Path("/workspace").rglob("*/*.md"): - print(f"Processing {path}...") + for path in sorted(pathlib.Path("/workspace").rglob("*/*.md")): + print(f"Adding {path} to the build queue") last_modified = datetime.datetime.fromtimestamp(path.stat().st_mtime).strftime("%Y-%m-%d %H:%M:%S") output_filename = path.parent / f"{path.stem}.html" - index_entries.write(f'
  • {path.parent.name}
  • \n') - Popen( - [ - "pandoc", - "--template", - "template.html", - "--toc", - "--katex=https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/", - "--metadata", - "toc-title=Indice", - "--metadata", - "lang=it", - "--metadata", - f"date={last_modified}", - "--metadata", - "maxwidth=100vw", - "--verbose", - "-o", - output_filename, - path, - ] - ).wait() - + if output_filename.name == "index.html": + index_entries.write( + f'