tools icon indicating copy to clipboard operation
tools copied to clipboard

Compatibility epub build breaks footer alignment in poetry

Open weijia-cheng opened this issue 3 years ago • 2 comments

This is what I came across while testing #511, the poetry build fix.

Despite de Cleyre having CSS to right-align footers, the footer in the compatibility build is left-aligned:

Screenshot 2022-04-22 at 08-49-08 Poetry

Inspection of the CSS indicates that the reason this is happening is that the compatible poem CSS is more specific than the footer CSS:

Screenshot from 2022-04-22 08-50-23

The relevant rules from the extracted CSS are

.epub-type-z3998-poem p,
.epub-type-z3998-hymn p{
  text-align: left;
  text-indent: 0;
}

and

footer{
  font-variant: small-caps;
  margin-top: 1em;
  text-align: right;
}

weijia-cheng avatar Apr 22 '22 15:04 weijia-cheng

It's not obvious to me how a general solution to this would look. We would have to calculate specificity for children of verse and try to generate a more specific selector to pass that specificity target. That sounds very complex. We can already get specificity but generating a selector to somehow achieve specificity + 1 without messing up any other selectors might not be solvable. This might just be a case where the Kobo build is going to have to suffer slightly because of their damn spans.

I'll leave this issue open for now in case someone wants to pick it up, or I get hit by inspiration. But, I don't have time to think about it any time soon unfortunately.

acabal avatar Apr 25 '22 23:04 acabal

Ok, I just want to point out that this isn't a Kobo problem only but affects all of the compatible (i.e. non-advanced) epubs.

weijia-cheng avatar Apr 25 '22 23:04 weijia-cheng