Giter VIP home page Giter VIP logo

inlinestyler's People

Contributors

dlanger avatar epegzz avatar halk avatar macro1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

inlinestyler's Issues

0.2.1+ no longer supports stylesheets in data URIs

It is possible to embed CSS inside the <style> element using the data: URI scheme. Like this:

<link rel="stylesheet" href="data:text/css,EMBEDDED_CSS_GOES_HERE">

This worked in 0.2.0, but doesn’t work in 0.2.1 with the move from urllib.urlopen() to python-requests.

It’d be nice to get this working again, though it’s arguably a requests issue.


I took a quick at requests, but I couldn’t determine if they have support for RFC 2397 (which defines the data: scheme).

I suggest leaving this bug open until either of us the time to investigate RFC2397 support in python-requests.

Silence warnings

Hi!

First of all - thanks for this really nice and helpful library!

It's not a bug, rather a feature request.

I'm getting tons of warnings like those:

WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.

Is there a way to silence them? I couldn't find any verbose option.

Thanks!
Daniel

update pip package

Hey Daniel,

would you mind updating the package in the pip repository?
There's still the version that depends on django.

THX! :-)

Broken Python3 compatibility

Updating from 0.2.1 to 0.2.2 breakes on Python 3.4

File "/env/lib/python3.4/site-packages/inlinestyler/utils.py", line 17, in inline_css
    converter.perform(document, html_message, '', encoding=encoding)
File "/env/lib/python3.4/site-packages/inlinestyler/converter.py", line 62, in perform
    self.convertedHTML = etree.tostring(document, method="html", pretty_print=True).encode(encoding)
AttributeError: 'bytes' object has no attribute 'encode'

Version 0.2.2+ kills href attribute for link

Hello!

I use inlinestyler for preprocessing mustache-templates for emails.
Initial template has this link: <a href="{{config.url}}">Home</a>

And inline_css method encodes href: <a href="%7B%7Bconfig.url%7D%7D">Home</a>
After that mustache can't handle this template.

Version 0.2.1 doesn't have this issue. 0.2.2 and 0.2.3 - have

Crashes when bootstrap 3 css is included.

This code crashes with a NotImplemented exception.

from inlinestyler.utils import inline_css


html = """"

<!doctype html>
<html lang="en">
<head>

    <title>Charter 00144</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css"/>
</head>"""

print inline_css(html)

Generated HTML has self-closing tags: disliked by GMail

When certain HTML tags are turned into self-closing versions (e.g. <title />), GMail considers the entire HTML as invalid and will not display it.

  1. A quick workaround is to set method="html" in the etree.tostring call.
  2. On a more philosophical note, I'm not certain if the HTML standard allows or disallows self-closing tags.

IOError: Too many open files

Hi,
I have been getting the following error:
IOError: Too many open files: '/usr/local/lib/python2.7/dist-packages/inlinestyler/css_compliance.csv'

I was running this in a loop (5000+) and that's when this happened.

Add PyPi classifers to indicate Python 3 support

Does this module currently support Python3?

It would be good to update the supported platforms list on the PyPi record so it's explicit if there's support there. Will be testing this out soon in any case, so will update this ticket if it's not known.

SSLError 'bad handshake'

I'm getting this fetching a css from anazon cloudfront

44 venv/local/lib/python2.7/site-packages/inlinestyler/converter.py in perform
raise IOError('The stylesheet ' + element.get("href") + ' could not be found') ...

If I curl the url causing the issue straight from the machine everything is fine.
Even with openssl:
openssl s_client -connect d1q7usoul9xakv.cloudfront.net:443 -CApath /etc/ssl/certs/
Start Time: 144489408
Timeout : 300 (sec)
Verify return code: 0 (ok)

I fixed the issue with a hack, but I don't think is perfect:
In converter.py

Before
css_content = requests.get(csspath).text

After:
css_content = requests.get(csspath, verify=False).text

Can you please let me know if there is a better way to sort out this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.