Kozea / WeasyPrint

The awesome document factory
https://weasyprint.org
BSD 3-Clause "New" or "Revised" License
7.09k stars 675 forks source link

@footnote::before is not discarded #2215

Open rhn opened 1 month ago

rhn commented 1 month ago

The spec mentions the "footnote rule", but doesn't actually specify how to create it.

I tried to create a 20% wide rule with @footnote::before:

@page
   @footnote::before {
        display: block;
        width: 20%;
        border-top: solid 0.2mm;
    }
}

but the "::before" seems to be stripped and the rule applied to the entire area instead:

ss

Is it reasonable to expect "::before" to apply to the footnote area?

liZe commented 1 month ago

Hi!

The spec mentions the "footnote rule", but doesn't actually specify how to create it.

Here’s a simple example that will help.

Is it reasonable to expect "::before" to apply to the footnote area?

::before is a pseudo-element, it can only be applied to selectors. So it can’t be applied to @footnote and should give a warning (and discard the whole block) instead of being ignored.

(Let’s keep this issue open to track this bug.)

You can get what you want by removing the width and using a border gradient:

border-image: linear-gradient(to right, black 20%, transparent 20%) 1;