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

Use of leader() causes pdf generation to fail in 53 #1409

Closed
bubonicfred opened this issue Aug 1, 2021 · 1 comment
Closed

Use of leader() causes pdf generation to fail in 53 #1409

bubonicfred opened this issue Aug 1, 2021 · 1 comment
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@bubonicfred
Copy link

bubonicfred commented Aug 1, 2021

I'm using weasyprint via pandoc to generate printout files of essay collections from markdown. When generating the table of contents with the leader() attribute the pdf fails to generate and I get a traceback which ends in

File "/home/usr/.local/lib/python3.8/site-packages/weasyprint/layout/inlines.py", line 80, in handle_leaders text_box, = leader_box.children ValueError: not enough values to unpack (expected 1, got 0) Error producing PDF.

The relevant CSS I'm using is nav ul li a::after { content: leader('.') target-counter(attr(href), page); float: right; }
I am by far not the best at CSS, and the documentation for this function is patchy, So I could easily be at fault. 52 Simply skipped over leader(), and removing it allows the pdf to generate

@liZe liZe added the crash Problems preventing documents from being rendered label Aug 1, 2021
@liZe liZe added this to the 53.1 milestone Aug 1, 2021
@liZe
Copy link
Member

liZe commented Aug 1, 2021

Hello!

Thanks a lot for this bug report.

Using float for a block containing leaders is a bit "dangerous", because floats somehow try to be as small as they can be. So, in many cases, the current implementation doesn’t display the leaders at all, because they’re not "mandatory". The specification is not really clear about this, and I think that nobody knows how it’s supposed to work exactly.

Removing "float: right" should do what you expect.

But of course, it shouldn’t crash, we need a fix for this problem.

@liZe liZe closed this as completed in f327a9e Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

2 participants