-
Notifications
You must be signed in to change notification settings - Fork 93
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
aggressively converts html entities, not really usable for email templates #22
Comments
Thanks for the input! I haven't tried to use this on any templating Pynliner was first used on a django project where we used templates to
|
If you're sending out a non-personalized marketing email, it's no big deal. You only need to do this once. If you're sending out 1000+ of customized transactional emails, this can take quite a bit of CPU and time. on one of my boxes, it average 1.5s to parse and inline an email that is 'nonstandard' and .5s to parse a 'standard' one (via timeit, and only timing non-standard = hand drawn html having a .5 - 1.5s hit on every transactional or customized email is way too much of an overhead for our volume. Our current list size would take around an hour of processing time. |
You make a good case! Supporting template languages would be a great new
|
I think this is also causing a problem I'm seeing where it is converting some of the <> signs inside a conditional comment, which breaks the rendering of buttons for Outlook if you use the HTML provided by http://emailbtn.net/ turning them into things like this: <!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://localhost:8000/account/confirm_email/f10c6a42a92d1f16bb8d79d635f58fec56c4b7fb/" style="height:40px;v-text-anchor:middle;width:200px;" arcsize="8%" stroke="f" fillcolor="#da2929">
<w:anchorlock />
<center>
<![endif]--> Is this something BeautifulSoup is doing or is it the package? It looks like BS had problems with conditional comments in the past but there appear to be some workarounds. If you let me know where to look, I can take a crack at this as the package has proved very helpful. |
I'll need to do some investigating on where this occurs in the process. It On Tue, Jun 18, 2013 at 10:49 AM, Tom Clancy [email protected]:
|
Does this work/ do you need additional tests? Not sure if it's too simplistic or overly complicated. |
Thanks I'll take a look this evening. On Tue, Jun 18, 2013 at 2:27 PM, Tom Clancy [email protected]:
|
@jvanasco I'm still planning a complete rewrite with backwards compatibility on the same interface to be faster and more flexible than relying on beautiful soup but until the rewrite it has to go through beautiful soup which aggressively converts to HTML. |
TL;DR Work on the rewrite is continuing as I have time. My primary focus is making the conversion process more efficient. My secondary focus is supporting templating languages in an extensible way. I've recently been working on the rewrite and while trying for a flexible conversion process I've realized that while pynliner 1.0 can (and will) be built to support templating languages and made extensible to allow other templating languages/uses, complete CSS support cannot happen before a template is rendered. A simple example showing this if Template
Stylesheet
Output if template rendered first (Correct)
Output if applied to template first (Incorrect)
The problem here is the None of this prevents us from enabling conversion on templates but I will be focusing my effort on making the conversion process more efficient first. |
First off, thanks. This is a great package + well designed & documented.
I ran into some issues while trying to get this to work with mako templates (which i use to generate email).
mako templates don't work because the BeautifulSoup parser and formatter will kill things like:
and
becomes
I tried forking and running on BS4, which allows for a 'formatter' option to be used on printing ( overriding your
_get_output
function ). I couldn't find a formatter that creates reliable or desirable results.i think the design of this package will make it hard to work on templates for email , so i wanted to suggest a warning in the documents. If I have time, I might try and get this to work later in the week -- but I'm sadly not hopeful.
Anyways, great package.
The text was updated successfully, but these errors were encountered: