Skip to content
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
merged 37 commits into from Dec 11, 2021
Merged

Support footnotes #1509

merged 37 commits into from Dec 11, 2021

Conversation

liZe
Copy link
Member

@liZe liZe commented Nov 27, 2021

Fix #298.

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).
@liZe liZe added feature New feature that should be supported sponsored Issues sponsored to be resolved faster labels Nov 27, 2021
@liZe liZe added this to the 54.0 milestone Nov 27, 2021
grewn0uille and others added 13 commits November 29, 2021 12:18
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.
@liZe
Copy link
Member Author

liZe commented Dec 11, 2021

This branch is in good shape and is tested, it’s time to merge!

What’s missing from the specification:

  • the compact value of footnote-display,
  • resetting the counter value for each page (because the footnote counter is not a page-based counter).

@liZe liZe marked this pull request as ready for review December 11, 2021 17:23
@liZe liZe merged commit f124e31 into master Dec 11, 2021
@liZe liZe deleted the footnotes branch December 11, 2021 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature that should be supported sponsored Issues sponsored to be resolved faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support footnotes
2 participants