-
-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support footnotes #1509
Merged
Support footnotes #1509
Conversation
This file contains 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
As the bottom of the page is now dynamic (because it changes with footnotes), passing the max_position_y is difficult: it would require the value to be passed to layout functions, and returned (possibly updated) by these functions. The new solution is to store the page bottom in the context, and to update it when a footnote is included. The new max position y is calculated when needed, using the updated position of the page bottom. To handle extra bottom spaces (bottom padding/border/margin of a parent box for example), a bottom_space parameter is given when needed. This value can be set to -inf when we don’t want to take care of the page bottom (that’s equivalent to max_position_y=inf).
There’s nothing in the specification about that, but here’s what we do now: - The style of a footnote inherits from its parent’s style, it doesn’t inherit from the footnote area’s style. That’s how cascade works for real elements, and there’s no real reason or way to avoid this. - The style of a footnote marker inherits from the footnote style. The marker is just like a ::before block regarding to its style, even if it is actually put before the footnote element in the footnote body. - The style of a footnote call inherits from the footnote parent’s style. It doesn’t inherit from the footnote’s style, that’s actually applied to the footnote and inherited by its marker. This way, we keep the "normal" cascade for "normal" elements, and have everything else being quite obvious. The 1st point is annoying in real-life use cases, because we’d really like to see the footnote’s style inherit from the footnote area’s style. But we really don’t want to break the cascade. Do we? No, we don’t. The 3rd point is probably the most disturbing one, mainly because .footnote::footnote-call doesn’t match the call: to match a footnote call in a paragraph, for example, we have to use p::footnote-call instead.
Handling footnote-display requires the footnote area children to be recreated each time one footnote is added: as footnotes can be blocks or inlines, we have to create anonymous boxes each time, and thus to do the whole footnote area layout.
This branch is in good shape and is tested, it’s time to merge! What’s missing from the specification:
|
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.
Fix #298.