-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
Footnotes are sometimes placed on the page before the corresponding footnote call #1564
Comments
If a footnote has been output but we then decide to cancel the line it was output on, we should cancel the output of the footnote itself. This requires a bit of extra bookkeeping, so we know which footnotes are relevant, but otherwise largely works using the existing remove_placeholders code. Includes a minor refactor of footnote area management in LayoutContext, and a new testing utility: `tree_position`. Closes Kozea#1564.
Hello, first of all thank you for the Weasyprint. I'm still new to this library and I already love it! HTML CSS `@page { @top-center { @bottom-right { @footnote { } span.footnote { ::footnote-call { |
Hi! It’s definitely a bug, but it’s not related to this one (that is fixed). Could you please open another issue for your problem? It would also be very useful to have a full document (HTML, CSS and fonts) that shows the problem, otherwise we’ll probably not be able to reproduce it. If you can’t create a simple example, you can also share your document attached to the issue, or send by mail if it contains sensitive data. |
In some cases, which appears to be "when a footnote call would normally be set on one page, and there would be room for the footnote, but a later rendering check pushes the footnote to the next page", a footnote can appear on the page before its call. (This violates the GCPM spec which says "A footnote body must never be placed on a page before the footnote reference.")
A moderately minimal test case:
That produces footnote-wrap.pdf, which has a page break that looks like the following:
The blue div is simply used to push the red paragraph to approximately the correct position. The issue is that the (light blue) footnote call occurs on the page after the (green) footnote.
My speculation is that this happens because the footnote call site could fit on the first page if it were allowed to break (removing the
break-inside
rule renders "correctly"). It does not appear to be related to the fact that the entire paragraph may fit on the first page if the footnote area did not exist, as making the paragraph much longer still results in the same behavior. However, other ways of forcing the paragraph to wrap to the next page (such as settingorphans
orwidows
to 3) produce the same result: this isn't just an issue withbreak-inside
.I have not taken too much time to try to dig into why this occurs, and am mostly filing the issue in case you have ideas as to where to look. Otherwise I'll likely dig into this as time allows, possibly later this week.
The text was updated successfully, but these errors were encountered: