Repository navigation
Full-bleed render fixes, Process 1 image-crop fix, and content corrections - #48
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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.render.js, newrender_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).Test plan
direction="rtl"attribute bug that clipped text.https://claude.ai/code/session_01BXPXYXKZCgxnTSNDGCCGYq