fix footer/header behaviour - #549
Open
splitbrain wants to merge 1 commit into
Open
Conversation
The first-page header and footer were set with runtime SetHTMLHeader and SetHTMLFooter calls that were not bound to a specific page, so they spread beyond the first physical page onto the rest of the first content block and, for the header, even onto the following content while leaving the very first page without a header. They are now defined as named blocks bound through @page CSS rules: @page :first restricts the first-page block to the first physical page, while the odd and even blocks cover the remaining pages. Those blocks are redefined before each wiki page so their per-page placeholders (@id@, @pageurl@, @qrcode@, ...) resolve against the current page, and the first-page context is set before the document starts so the blocks defined at start-up resolve too. Fixes #548
Collaborator
|
Works fine (now tested for single page only) for the following combinations, with ToC enabled:
However, the two deviations happened before the refactoring as well. Probably this is quirk of mPdf. I guess because the ToC generation happens later, and :first is applied to the actual first page that is generated. |
Collaborator
|
So it seems the header/footer for first page works only correctly when a cover page is used... likely, that is the most used application for the first page footer/header. |
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.
I had switched to runtime setting of headers and footers to be able to dynamically set the context when multiple pages are exported (eg. have the header reflect the currently rendered wiki page). But that had issues, especially for the first page template.
This switches to mPDF's named headers. The named headers are assigned via CSS just as before, but are now dynamically redefined on every new page.
@Klap-in can you check if this solves issue #548?