Fix blank page issue - #556
Open
splitbrain wants to merge 2 commits into
Open
Conversation
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.
Collaborator
|
Nice tests! Looks good. |
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.
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.