feat(templates): keep ModernProposal section headings with their content across page breaks#433
Merged
Merged
Conversation
…ent across page breaks Each flowing heading in ModernProposal (the per-section titles, Timeline, Investment, and Acceptance terms) was a bare paragraph sibling to its body, so a heading could strand alone at a page bottom while its content flowed to the next page. Wrap each in its own keepWithNext() section so the title relocates with the first slice of the block it introduces. The wrapper is zero-padding/zero-margin with the title as its single child, so placement is unchanged unless a heading would otherwise strand. No engine change.
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.
Why
ModernProposalemitted each flowing section heading as a bareaddParagraph(...)sibling to the body or table it introduces. When a heading landed near the bottom of a
page and the first slice of its content didn't fit below it, the heading rendered alone
at the page bottom while its content flowed to the next page — a boxed title stranded
from what it introduces (the "Investment" heading on page 1, its table on page 2).
What changed
ModernProposal— the per-section loop title,Timeline,Investment, andAcceptance terms— now render inside their ownSectionBuilder.keepWithNext()section instead of a bare paragraph, so each titlebinds to the first slice of the block it introduces and relocates with it across a
page break.
keepWithNext()binds a section to its following sibling, so theheading has to be its own section; the wrapper is zero-padding / zero-margin with the
title paragraph as its single child, so placement is unchanged unless a heading would
otherwise strand.
keepWithNext()already exists ondevelop; this is templatewiring only.
presets are already wired (
ModernProfessional,BoxedSections,ClassicSerif, …);the CV two-column presets and the invoice build their bodies as an atomic
addRow(...)that never splits across a page, so a heading there cannot strand; thecover letter has no interior section headings.
Verification
./mvnw -B -ntp clean verify -pl :graph-compose-templates,:graph-compose-qa -am→BUILD SUCCESS.
Focused:
./mvnw test -f qa/pom.xml -Dtest=ProposalHeaderKeepWithNextTest,ProposalV2VisualParityTest,ModernProposalSmokeTest→ Tests run: 9, Failures: 0.
ProposalHeaderKeepWithNextTest: asserts the four title sections arekeep-with-next (positive) and the body sections are not (negative — marking the body
would bind the heading to the next block); an end-to-end test reproduces the
template's separate-
pageFlow().build()-group shape and asserts the title relocatesto its body's page, with a control proving the title strands on the earlier page
without the flag.
ProposalV2VisualParityTestpasses with no baseline re-bless — the wrapper isgeometry-neutral on the canonical sample.
Lane: templates (canonical) —
ModernProposalpreset wiring; no engine orpublic-API surface touched.