1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 06:18:42 +03:00
This commit is contained in:
Anton Afanasyeu
2026-06-11 18:37:48 +02:00
parent 0431bafd74
commit 9d9a6d66d9
87 changed files with 4443 additions and 1190 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Build docs/<name>.pdf for every docs/*.md (top-level only, not _pdf_build/)."""
"""Build docs/**/*.pdf for every docs/**/*.md (recursive; skips _pdf_build/)."""
from __future__ import annotations
@@ -25,21 +25,43 @@ SUBTITLE = {
"20260610_SERVICES.md": "Exposed services catalog — URLs, APIs, validation — 2026-06-10",
}
SUBTITLE_BY_REL = {
"specs/20100611_3_url_shortener.md": "URL shortener service — SPEC (post-alpha, s.f0xx.org)",
"DRs/20100611_3_url_shortener.md": "URL shortener service — design review",
}
def iter_markdown_files() -> list[Path]:
out: list[Path] = []
for md in sorted(DOCS.rglob("*.md")):
if "_pdf_build" in md.parts or "drafts" in md.parts:
continue
out.append(md)
return out
def rel_label(md: Path) -> str:
try:
return str(md.relative_to(DOCS))
except ValueError:
return md.name
def main() -> int:
md_files = sorted(DOCS.glob("*.md"))
md_files = iter_markdown_files()
if not md_files:
print("No markdown files in docs/", file=sys.stderr)
return 1
ok = 0
for md in md_files:
out = md.with_suffix(".pdf")
subtitle = SUBTITLE.get(md.name, f"From {md.name}")
rel = rel_label(md)
subtitle = SUBTITLE_BY_REL.get(rel, SUBTITLE.get(md.name, f"From {rel}"))
try:
build_pdf_from_markdown(md, out, doc_subtitle=subtitle)
ok += 1
except Exception as e:
print(f"FAIL {md.name}: {e}", file=sys.stderr)
print(f"FAIL {rel_label(md)}: {e}", file=sys.stderr)
print(f"Built {ok}/{len(md_files)} PDFs under docs/")
return 0 if ok == len(md_files) else 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB