WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

target-text(attr(href)) "inherits" text-transform: uppercase

Open pmjdebruijn opened this issue 1 year ago • 1 comments

In this example: target-text-attr-bug.zip

The headers are uppercased through CSS:

h1 { text-transform: uppercase; break-before: page; }

And referenced in the Table of Contents via target-text:

#contents ul li a::before { content: target-text(attr(href)); }

Note that the input text is normal mixed case:

<li><a class=h1 href="#Introduction"></a></li>

<h1 id="Introduction">Introduction</h1>

However the target-text in the ToC ends up being uppercased, as opposed being mixed case. I'm not sure whether this is intended (poor spec again) or accidental (i.e. a bug). Practically it would make sense for target-text to retrieve the original untransformed text, so text-transform can be applied independantly (or NOT).

pmjdebruijn avatar Oct 08 '23 12:10 pmjdebruijn

Thanks for the report.

Looks like it’s a bug in WeasyPrint, even if the specification is not 100% obvious about this (talking about "string value".

Related to #137.

liZe avatar Jan 26 '24 14:01 liZe