Update French reports and localised PDF baselines
Beffroi Reporting CI A component or integration check failed.
Beffroi/beffroi-reporting/pipeline/head There was a failure building this commit Details

This commit is contained in:
Dandaedre 2026-09-25 11:44:33 +02:00
parent ac4d06a4bc
commit d1cb971b1b
3 changed files with 28 additions and 6 deletions

@ -1 +1 @@
Subproject commit 42edeef51ef8c155a904ad3b43bdb28fc76ca925
Subproject commit 9ee41254edbe402a7d8a01bb414815e7e7695cac

@ -1 +1 @@
Subproject commit 41cd1b7797a45dcfd7c3922c190506339a2cf59e
Subproject commit 8a289b9950679aa3a127e69d9653b7b32696551c

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Compare a publication with the original Typst renderer's 17 PDFs."""
"""Check 17 published PDFs against legacy and explicitly localised baselines."""
import hashlib
from pathlib import Path
@ -63,6 +63,23 @@ EXPECTED_PYPDF = {
}
# These authored French reports now opt into French renderer labels. Preserve
# the original baselines above, but check their intentional new output here.
# Original English-heading raster references do not apply to these reports.
LOCALISED_REPORTS = {
"2026-09-04-report": (
2,
"7072853466f306b8a9a07210734340c6c755d3efc448c3a4f7ea00dd2eb86580",
"10e4307a0b1a97471c244460e2133825707a2dbd569329e227082cd9bf4fd5a3",
),
"2026-09-15-clevo-diagnostic-synthesis": (
3,
"363ff0a060f0d60e60a45bdb1e1e4af92be652039e44814dc4e422aabbb25179",
"30ad12bc70bafd198d1166b9935609f3811d334ffcfa4584c353c427a710f5bf",
),
}
def portable_pdf_info(pdf):
reader = PdfReader(pdf)
text = "\n".join(page.extract_text(extraction_mode="layout") for page in reader.pages)
@ -98,18 +115,23 @@ def main():
return 1
for name, (wanted_pages, wanted_text) in documents.items():
pdf = actual[name]
if portable_pdf_info(pdf) != (wanted_pages, EXPECTED_PYPDF[category][name]):
localised = category == "reports" and name in LOCALISED_REPORTS
wanted_pypdf = EXPECTED_PYPDF[category][name]
if localised:
wanted_pages, wanted_text, wanted_pypdf = LOCALISED_REPORTS[name]
if portable_pdf_info(pdf) != (wanted_pages, wanted_pypdf):
print(f"{category}/{name}: page count or text differs", file=sys.stderr)
return 1
if check_poppler_text and text_hash(pdf) != wanted_text:
print(f"{category}/{name}: Poppler text differs", file=sys.stderr)
return 1
if check_raster:
if check_raster and not localised:
reference = REFERENCE / ("diagnostics" if category == "diagnostics" else "") / f"{name}.pdf"
if not raster_equal(reference, pdf):
print(f"{category}/{name}: rendered pages differ", file=sys.stderr)
return 1
print("All 17 PDFs match original text and pagination" + (" and rendered pages" if check_raster else ""))
print("All 17 PDFs match expected text and pagination (15 legacy, 2 localised)"
+ ("; legacy rendered pages also match" if check_raster else ""))
return 0