Merged
Conversation
This was referenced Aug 26, 2024
1 task
1 task
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 pull request refactors and improves realization and page layout, fixing various bugs in the process.
Changes
Page styles are now resolved in a smarter way: Beyond taking the intersection of the styles of all elements in a page run (consecutive content between two pagebreaks / document boundaries), there are a now few rules according to which styles are filtered: To be used at the page level, styles must now be
outside && (initial || liftable).text(red, page(..)) makes the footer red.)set page(..); set text(red)the red text is kept even though it comes after the weak pagebreak from set page.set page(..); text(red)[..]the red isn't kept because the constructor styles are not liftable.This fixes the problem that the page's header and footer inherit styles from headings or other elements on the page.
All locatable elements now emit a start and an end tag instead of just a single tag. This is primarily useful for future work on Tagged PDF, but it also allows us to correctly determine the exact position of an element in cases where we previously couldn't. In the case of
show heading: it => pagebreak() + it, the heading's position will be after the pagebreak because neither visible content nor the matching end tag occurred before the pagebreak. Meanwhile, inmetadata("hi") + pagebreak(), the position of the metadata will be before the pagebreak because it's end tag already appeared before the pagebreak. Notably, this means that the nesting of zero-sized elements is not necessarily preserved in the tag output (if the metadata was inside of the heading show rule, it remains before the pagebreak, but the heading migrates to after it).Fixes for various interactions between tags and layout & styling: Unless there is a bug, a tag should never have any effect on the page layout anymore. In particular, it shouldn't append, prepend, or force any empty pages. It will also not affect shared page style resolution anymore. There is also a new mechanism where tags can be conceptually "between pages" (or more concretely, at the very start or end of pages, even before the header or footer). This behaviour is triggered when a tag is sandwiched in between two weak pagebreaks (or a weak pagebreak and a document boundary). This is primarily useful to step the page counter between a header and a footer, which was previously not possible.
The
pageconstructor does not emit a page element anymore. Instead, it works like theparandtextconstructors. It merely inserts pagebreaks and applies styling. This unifies things and also means thatcontext page.marginalso works within apage(margin: ..)[..]. The notion of an instantiated page element is not useful anyway because page show rules are (a) currently completely useless and (b) will be special when they are not useless anymore.Weak pagebreaks are now resolved during layout instead of realization, fixing weird interactions between
to: "odd" | "even"andweak, and the problem that a single weak pagebreak produced an empty document.Linked issues
place()/move()insidelocate()shifts the returned position #1833#pagecall state and counter updates before it are ignored #2172set pageinsidecontextappends empty page #2326pagebreakproduces 0 pages #2591pagebreak(to: _)#2841#set page(..)doesn't work directly after tag #2987#context page.margincan't get margin from an ad-hoc#page#3671