Skip to content

feat(templates): keep ModernProposal section headings with their content across page breaks#433

Merged
DemchaAV merged 2 commits into
developfrom
feat/templates-keep-with-next
Jul 24, 2026
Merged

feat(templates): keep ModernProposal section headings with their content across page breaks#433
DemchaAV merged 2 commits into
developfrom
feat/templates-keep-with-next

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

ModernProposal emitted each flowing section heading as a bare addParagraph(...)
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

  • The four flowing headings in ModernProposal — the per-section loop title,
    Timeline, Investment, and Acceptance terms — now render inside their own
    SectionBuilder.keepWithNext() section instead of a bare paragraph, so each title
    binds 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 the
    heading 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.
  • No engine change — keepWithNext() already exists on develop; this is template
    wiring only.
  • Other template families need no change and are left untouched: CV single-column
    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; the
    cover 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.

  • New ProposalHeaderKeepWithNextTest: asserts the four title sections are
    keep-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 relocates
    to its body's page, with a control proving the title strands on the earlier page
    without the flag.
  • ProposalV2VisualParityTest passes with no baseline re-bless — the wrapper is
    geometry-neutral on the canonical sample.

Lane: templates (canonical) — ModernProposal preset wiring; no engine or
public-API surface touched.

DemchaAV and others added 2 commits July 23, 2026 22:47
…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.
@DemchaAV
DemchaAV merged commit 1aa0954 into develop Jul 24, 2026
12 checks passed
@DemchaAV
DemchaAV deleted the feat/templates-keep-with-next branch July 24, 2026 06:07
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