Skip to content

Full-bleed render fixes, Process 1 image-crop fix, and content corrections - #48

Merged
sclintonowasp merged 5 commits into
mainfrom
process2-ru-RU-test
Oct 8, 2026
Merged

sclintonowasp merged 5 commits into
mainfrom
process2-ru-RU-test

Conversation

@sclintonowasp

Copy link
Copy Markdown
Member

Summary

  • Process 1 (pdf_split.py/image_svg.py): fixes a real crop-truncation bug where a figure built mostly from vector-drawn shapes around a small embedded raster was cropped to just that raster's narrow bounds. Generalizes to any future document — thresholds are content-driven (OCR cluster counts, geometric proximity), not tied to this document's own layout.
  • Process 2/3 (render.js, new render_docx.js/render-docx.sh): cover/TOC/page-decoration backgrounds now bleed edge-to-edge; cover layout (left-aligned, kicker, H1-divider); TOC continuation-page fixes; Sponsors page now has a real intro paragraph + H1 title (sourced from each locale's own already-translated figure content) and always starts a fresh page alongside Project Supporters; several real bugs found and fixed along the way (baked-in JPEG border, TOC crop rounding gap, a pdf-lib buffer-pooling bug, a body-margin reset).
  • Content: split crammed two-names-per-line contributor entries across all locales; rebuilt the truncated "Agentic Top 10 at a glance" diagram for de-DE/fa-IR/fr-FR (ru-RU was already a correct hand-rebuilt vector reconstruction, used as the template) using each locale's own already-translated label text.
  • Release: regenerated draft PDFs for all four locales (ru-RU, de-DE, fa-IR, fr-FR).

Test plan

  • Process 1 fix validated against the real source PDF (57 pages): only 3 pages differ from old behavior, all improvements (the diagram fix, a pre-existing duplicate-crop cleanup, a 2.5mm refinement) — no regressions after calibrating two safety thresholds against real false-positive cases found during validation.
  • All four locale PDFs re-rendered and visually verified (cover, TOC, sponsors, diagram, contributor list) — no stray blank pages, no overflow, page counts stable.
  • fa-IR (RTL) diagram legend specifically re-checked after finding and fixing a real direction="rtl" attribute bug that clipped text.
  • Native-speaker review flagged for two specific items: the "Cole Murray"/"Venkata Sai Kishore Modalavalasa" name-split boundary (no comma in source), and fa-IR's "Connected data/RAG" diagram box label (reconstructed from scrambled OCR order).

https://claude.ai/code/session_01BXPXYXKZCgxnTSNDGCCGYq

Scott Clinton added 5 commits October 7, 2026 20:47
… raster

pdf_split.py's _image_events() cropped each figure to exactly the
embedded raster image's own bounding box. A figure built mostly from
vector-drawn shapes (box outlines, arrows, pill headers) around one
small embedded raster was getting cropped to just that raster's own
narrow bounds, truncating most of the actual figure -- confirmed on a
real document where a diagram's true extent was roughly square but the
old crop came out short and wide, missing the entire top row and legend.

_expand_to_connected_shapes() grows an image's crop to absorb any
vector shape touching it (directly or transitively), gated on the raw
crop already showing real OCR text via a new, stricter
MIN_CLUSTERS_TO_EXPAND bar (separate from image_svg's existing
MIN_CLUSTERS_TO_CONVERT) -- calibrated against real data after finding
two regressions during validation: expanding indiscriminately let a
page's purely decorative corner image chain into an unrelated nearby
table and balloon to ~80% of the page, and the existing 3-cluster
"worth converting" bar alone wasn't strict enough to rule out a few
real words bleeding in from an adjacent table's first row. Both
thresholds are content-driven, not tied to this document's own layout,
so this holds for any future document split through Process 1.

Claude-Session: https://claude.ai/code/session_01BXPXYXKZCgxnTSNDGCCGYq
…erator

Process 2 (render.js), cumulative across one extended working session:

- Cover, TOC, and page-decoration backgrounds now bleed edge-to-edge
  with zero margin on all sides. Puppeteer's PDF margin option reserves
  space entirely outside the HTML viewport, so nothing -- fixed or
  flowing -- can paint there; cover and TOC now render at zero margin
  (the inset moved into CSS padding instead), while legal/body keep
  their original margin and pagination untouched, with the page
  decoration composited directly onto the merged PDF via pdf-lib so it
  can bleed without touching that fragile pass. Found and fixed real
  bugs along the way: a baked-in border on the cover source JPEG, a
  sub-pixel rounding gap specific to the TOC's nested crop wrapper, a
  pdf-lib JPEG-embedder bug triggered by Node's buffer pooling, and a
  body-margin reset needed once sections started relying on exact
  physical page height.
- Cover: left-aligned title block with a small-caps kicker and H1-style
  divider line below the title, replacing the original centered layout;
  title size and kicker casing tunable independently of body H1 styling.
- TOC: background-to-heading gap halved; continuation pages (when the
  TOC spans more than one) now get real top padding via
  box-decoration-break:clone and the same page-decoration every other
  content page gets, instead of starting flush against the page edge.
- Sponsors page: real intro paragraph(s) and a "Sponsors:" heading now
  precede the logo image, extracted from each locale's own already-
  translated figure content rather than left blank; title promoted to
  a real H1 (picks up the standard underline, and now appears in the
  TOC like every other section); both the Sponsors and Project
  Supporters/Partners sections always start a fresh page.
- A diagram-only page's own text split (pure OCR-garbled on-image
  labels, not prose) is now recognized and dropped in favor of the real
  figure, keeping just the page's genuine heading.

Process 3 (render_docx.js, render-docx.sh, both new): DOCX output for
the same asset/locale/template combination render.js produces as PDF,
sharing render.js's registry/config loaders. Its output is git-ignored
(**/release/*.docx) and never committed to this public repo -- a DOCX
embeds translations-templates' real brand images verbatim in
word/media/, unlike the PDF, the one sanctioned public-distribution
format for those assets.

Claude-Session: https://claude.ai/code/session_01BXPXYXKZCgxnTSNDGCCGYq
…ce diagram

Additional Contributors/Другие участники/etc.: the source document's
original two-column layout had two names crammed onto each OCR'd line
(e.g. "Almog Langleben, Sunbit Ron Bitton, Intuit"); split onto one
name per line in _source and all four locales (names/affiliations are
proper nouns, unchanged across locales -- only the section heading
differs). One entry had no comma to guide the split and was separated
by naming-convention inference rather than a confirmed source boundary
("Cole Murray" / "Venkata Sai Kishore Modalavalasa") -- lowest-
confidence call in this set, flagged for review.

Agentic_Top_10_At_A_Glance_Figure_2.svg (de-DE, fa-IR, fr-FR): rebuilt
using ru-RU's own hand-drawn vector reconstruction as the structural
template, substituting each locale's own already-translated labels
(read from that asset's own .md text-layer extraction, which wasn't
affected by the crop bug fixed separately in pdf_split.py). fa-IR's
"Connected data/RAG" box label had to be reconstructed from genuinely
scrambled OCR reading order and is flagged in the file's own comment
for a native speaker to confirm; the other labels and all ten legend
entries were unambiguous in the source text.

registry.yaml: this asset's template was onboarded against the wrong
one (blue instead of green); bootstrap_asset.py gains a --template
correction path for exactly this case (registry-only, no folder
changes -- render time always resolves the template from registry.yaml).

Claude-Session: https://claude.ai/code/session_01BXPXYXKZCgxnTSNDGCCGYq
Process 2 output reflecting this session's full-bleed/layout/sponsors
fixes and the content corrections (names, diagram), for ru-RU, de-DE,
fa-IR, and fr-FR.

Claude-Session: https://claude.ai/code/session_01BXPXYXKZCgxnTSNDGCCGYq
Caught during review of this branch's own PR -- a debugging aid added
mid-session to inspect generated HTML directly, never meant to ship.
Default behavior (clean up tmpDir) is unchanged.

Claude-Session: https://claude.ai/code/session_01BXPXYXKZCgxnTSNDGCCGYq
@sclintonowasp
sclintonowasp merged commit 414f342 into main Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant