Closed Bartvaderkin closed 4 months ago
Hi @Bartvaderkin!
Thanks for reporting - I thought I fixed this a while ago (there are also tests for it), but apparently it didn't work. Let me check it
Here is what I have as input to the css-inline
CLI:
<html>
<head>
<style>
h1 {
color: #000000;
font-family: "Ubuntu", "Helvetica", Arial, sans-serif;
font-weight: 600;
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<h1>Test</h1>
</body>
</html>
The result:
<html><head>
</head>
<body>
<h1 style="color: #000000;font-family: 'Ubuntu', 'Helvetica', Arial, sans-serif;font-weight: 600;padding: 0;margin: 0;">Test</h1>
</body></html>
Which seems to be correct. For Python:
In [1]: import css_inline
In [2]: html = """<html>
...: <head>
...: <style>
...: h1 {
...: color: #000000;
...: font-family: "Ubuntu", "Helvetica", Arial, sans-serif;
...: font-weight: 600;
...: padding: 0;
...: margin: 0;
...: }
...: </style>
...: </head>
...: <body>
...: <h1>Test</h1>
...: </body>
...: </html>
...: """
In [3]: print(css_inline.inline(html))
<html><head>
</head>
<body>
<h1 style="color: #000000;font-family: 'Ubuntu', 'Helvetica', Arial, sans-serif;font-weight: 600;padding: 0;margin: 0;">Test</h1>
</body></html>
The example above uses the latest version from the repository which is the same as 0.13.0
(there were no relevant changes from that point).
Could you, please, share the content of css_inline.__build__
?
@Bartvaderkin checking if you have any updates on this issue?
Hey @Bartvaderkin
Are there any updates? Otherwise, I can't reproduce the issue
Closing as I can't reproduce the reported issue with the recent library version.
I found this CSS rule with double quotes in the font-family values, and it looks like the inliner doesn't transform the quote style so the copied values break the double quotes of the generated style attribute:
Our case is easily fixable by using single quotes (and of course these particular font names don't even have to be quoted), but it feels like there could be an issue:
This is on Python 3.11.5 and css-inline 0.13.0