Open vpoulailleau opened 6 months ago
Hi!
Thanks for the report. Media queries are not very well supported, this is an old problem, see #494.
The main problem we have with media queries is that it’s hard to define the viewport dimension on paged media. But supporting "only" (and probably "not", "or" and "and", as long as we have only media types) is actually much easier.
Interested in adding this feature? That’s a good first issue if you have some Python skills and no idea about how WeasyPrint works!
The magic happens here: https://github.com/Kozea/WeasyPrint/blob/d5d7ce369aef035712cf73446f9085a32105846f/weasyprint/css/media_queries.py#L25-L39
@liZe I currently don't have the time right now. But I would be glad to help.
BTW, will there be a coding sprint for weasyprint at PyCon FR 2024? I planned to come and help Julien for the Python docs translation, but I would be happy to better understand weasyprint that I use quite often. We saw each other during last AFPy's assemblée générale !
I currently don't have the time right now. But I would be glad to help.
No problem, let’s save this chance to another newcomer!
BTW, will there be a coding sprint for weasyprint at PyCon FR 2024? I planned to come and help Julien for the Python docs translation, but I would be happy to better understand weasyprint that I use quite often. We saw each other during last AFPy's assemblée générale !
😄
I don’t think that we’ll have the time to organize a coding sprint because we’re quite busy with the organization (and Julien will be happy to have you). But we’ll probably find the time to talk about WeasyPrint’s internals!
I imagine it takes time to organize everything.
Yes, see you in Strasbourg!
With weasyprint 62, I get
WARNING: Invalid media type ' only print ' the whole @media rule was ignored at 3:5.
for the following HTML:According to https://www.w3.org/TR/mediaqueries-5/#typedef-media-query-list this is valid CSS.
only
seems not supported yet (I haven't testednot
,or
,and
for@media not screen
for instance).I can easily workaround this limitation by removing
only
.