Fix blank page after every region in region-day PDFs - #115
Open
anchovie91471 wants to merge 2 commits into
Open
Conversation
.region got `page-break-after: always` in region-day mode, but the only suppressor was `.day:last-child` -- there was no `.region:last-child` counterpart. Mirrors the existing rule; `:last-child` (0,2,0) outranks the bare `.region` (0,1,0), so source order is unaffected. The new selector is inert in day-region mode, where .region never gets a break. The impact is much larger than a single trailing page. Feeds over 500 meetings take the chunked path in Controller::pdf(): each top-level group renders as its own standalone PDF and the results are merged with FPDI. In region-day mode every chunk holds exactly one region, so pre-fix that lone .region always emitted a trailing break -- producing a blank page at the end of *every* chunk, all of which survive the merge. A 60-region feed rendered 120 pages, 60 of them blank; with the fix it renders 60. This is also why day-region was never affected: `.day:last-child` was already doing this job for day chunks. Adds three regression tests: the chunked path (60 regions, >500 meetings, asserts one page per region -- fails at 120 pre-fix), plus the original small-feed region-day case and a day-region control that passes either way. The small-feed tests alone were insufficient: everything under 500 meetings takes a fast path that never exercises the merge.
region-day rendered `<span class="heading">{{ $region }}</span>`
unconditionally, so a feed containing meetings with no region produced an
empty heading for that group. The span carries `border-bottom: 0.5px
solid black`, so it printed as a stray horizontal rule above content with
no title -- visible as the untitled first group in large directories.
day-region already guards its label with `@if ($region)`, as does the
nested day subheading directly below. This mirrors that guard.
Adds a regression test rendering the template with a region-less group.
anchovie91471
force-pushed
the
fix/region-day-blank-page
branch
from
August 2, 2026 16:08
bac2958 to
3ff0c34
Compare
joshreisner
approved these changes
Aug 2, 2026
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.
Problem
In
region-daywith page breaks, large directories emit a blank page afterevery region — a 204-page directory contained 96 blank pages.
Root cause
Controller::pdf()has two render paths, split at 500 meetings. At or below500 it renders one document. Above 500 it renders each top-level group as its
own PDF and merges with FPDI — in
region-daythat is one region per chunk..regionhadpage-break-after: alwayswith no:last-childsuppressor, soevery chunk ended with a trailing break and a blank page, all preserved by the
merge.
day-regionwas unaffected because.day:last-childalready existed.Fix
Adds
.region:last-childto the existing suppressor rule. Within each chunk thelone region is
:last-child, so the trailing break is suppressed.Measured on a 60-region / 540-meeting feed: 120 pages (60 blank) → 60 pages
(0 blank).
Second commit:
region-dayrendered its heading unconditionally, so meetingswith no region produced an empty
.heading— printing as a stray horizontalrule above an untitled group.
day-regionalready guards this; now both do.Tests
Four regression tests, each verified to fail without its fix. The key addition
is chunked-path coverage: previously every test stayed under the 500-meeting
threshold and therefore exercised the wrong renderer, which is how this bug
was previously mis-scoped as a single trailing page.