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
string-set does not work with display: none #473
Comments
A workaround is to avoid "display: none" and instead use e.g. "font-size: 0pt;" but that may have other implications on how style is applied to your document. |
It's only a draft, but it's explicit:
It's a bug! |
Workaround for named strings from META elements: head,
head > title,
head > meta {display:inline}
meta[author] { string-set: author attr(author); }
head > title { string-set: title content(); }
Had a hard time to figure out why my front page refused to adopt the |
Sorry to bother, but you could give me an example how would this look on a Jinja2 template? I’m using them to generate the PDFs.
Cheers.
|
Don't know Jinja2, but I'm shure there's a place to tell the template engine which css styles to apply. Something like |
If I have a standard <meta name="author" content="Joe Bloggs"/> Then I would expect (according to Tontyna's workaround) this would work: head > meta { display: inline; }
meta[name="author"] { string-set: author attr(content); } It's not working in Weasyprint, but does work in another formatter I've tried (Oxygen PDF Chemistry). Am I missing something? Maybe the fix is to change the UA stylesheet; since |
You've missed a line out of Tontyna's workaround: you're saying that |
You are correct, @Smylers. Changing the selector to Lots of moving parts to coordinate, but once you get it all together it seems to work pretty well! |
When using -weasy-string-set with content that is hidden using css "display: none;" the content is not copied to the css string.
Example:
Here I expect the div not to show but "This is the text" to appear in the page header. Instead the text is hidden both in the body div and the header.
If I remove the "display: hidden;" directive from my style sheet, the text appears both in the document body and header.
I'm not 100% sure this is an error (the feature is after all only from a draft specification), but it seems reasonable that it should be possible to copy hidden text into CSS strings.
The text was updated successfully, but these errors were encountered: