WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

possible regression of issue #794 / #798

Open perado42 opened this issue 3 years ago • 1 comments

I have a symptom that looks like the one described in #794.

...
  File "/opt/pyenv-weasyprint/lib/python3.9/site-packages/weasyprint/document.py", line 216, in <listcomp>
    [Page(page_box) for page_box in page_boxes],
  File "/opt/pyenv-weasyprint/lib/python3.9/site-packages/weasyprint/layout/__init__.py", line 128, in layout_document
    pages = list(make_all_pages(context, root_box, html, pages))
  File "/opt/pyenv-weasyprint/lib/python3.9/site-packages/weasyprint/layout/page.py", line 854, in make_all_pages
    resume_at = context.page_maker[i + 1][0]
IndexError: list index out of range

The issue seems to disappear after doing nothing but editing of pure characters.

It seems to exist in the latest version 56.1 but seems to disappear when downgrading to version 45 (the version closest to the #798 fix).

perado42 avatar Aug 03 '22 12:08 perado42

gutachten.weasyprint.html.zip

Attaching the input file that produced the problem.

When running weasyprint as-is, it should produce the error.

Try editing some characters at roundabout line 251 where it says <em>Boemke, d</em> / <em>Ulrici, d</em>, , to watch the error disappear.

perado42 avatar Aug 03 '22 12:08 perado42

Thanks a lot for the bug report.

The problem is not a regression of #794 / #798, it happens when all these conditions are met:

  • a footnote should be displayed on a page but doesn’t have the place to be displayed, and
  • this page has to be repaginated, and
  • the pages after this page don’t have to be repaginated.

Guess what? You’re exactly in this situation! The first page includes a table of contents whose page numbers have to be set during a repagination (after the actual pages numbers have been found) and a footnote on the last line of the page that has to be saved for the next page. The next pages don’t change because of the table of contents, they don’t have to be repaginated.

liZe avatar Aug 15 '22 09:08 liZe