Skip to content

Fix blank page issue - #556

Open
splitbrain wants to merge 2 commits into
masterfrom
fix555
Open

Fix blank page issue#556
splitbrain wants to merge 2 commits into
masterfrom
fix555

Conversation

@splitbrain

Copy link
Copy Markdown
Owner

This fixes #555 and also adds tests that should cover the whole range of toc/cover/header/footer combinations we worked on during the last days.

The cover page defers its page break to the next block of content, but
<tocpagebreak> starts a new page by itself. With both a cover page and a table
of contents enabled, the first wiki page emitted that deferred break on top and
left the page opened by <tocpagebreak> empty. Since mPDF inserts the ToC before
that page, the blank page appeared between the ToC and the first content page.
For double-sided documents it additionally pushed the first content page onto
an even page.

The deferred break was introduced in c5c184f. Before that the cover page break
was written ahead of the ToC, where mPDF dropped it because the page was still
empty.

Fixes #555
Which page the parts of an export end up on, and which header and footer they
carry, follows from the interplay of the template files, the ToC setting and
double-sided output. That combination has been the source of several
regressions, most recently the blank page fixed in 591d7d2.

The combinations are walked as two matrices: one over cover page, back page,
ToC and double-sided output, checking what each page of the result holds, and
one over the header and footer variants a template can provide, checking which
variant applies to which page and which page context its placeholders were
resolved against.

The composition is read from the finished mPDF instance rather than from the
PDF, whose text is encoded against the embedded font subsets and no longer
tells which template a line came from. The fixture templates are copied into
the plugin while the test runs, since templates are only ever resolved
relative to the plugin directory.
@Klap-in

Klap-in commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Nice tests! Looks good.

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.

additional blank page

2 participants