emencia / emencia-django-newsletter

An app for sending newsletter by email to a contact list.
189 stars 72 forks source link

Beautifulsoup's prettify is harmful in some cases #42

Closed drye closed 12 years ago

drye commented 12 years ago

In some cases Internet Explorer's HTML parser will take newlines and additional spaces generated by prettify and mangle the rendered table output. In the following example the white space between the image tag and the closing td tag will corrupt the rendered layout - alas only in Internet explorer (the cell gets additional margin space)

This is what beautiful soup does:

    <td style="width: 30px; height: 111px;">
     <img width="30" height="111" src="https://pohrust.si/static/img/ur.jpg" alt="" />
    </td>

This is how IE sees it:

    <TD style="WIDTH: 30px; HEIGHT: 111px"><IMG alt="" src="https://pohrust.si/static/img/ur.jpg" width=30 height=111> </TD> </TR>

Is it possible to instruct beautiful soup to simply "not prettify"? If so I'd really like to see a setting for that.

Thanks!

drye commented 12 years ago

I added a pull request to address this issue: https://github.com/Fantomas42/emencia-django-newsletter/pull/45