rennat / pynliner

Python CSS-to-inline-styles conversion tool for HTML using BeautifulSoup and cssutils
http://pythonhosted.org/pynliner/
181 stars 93 forks source link

Test for issue #22 #23

Closed tclancy closed 11 years ago

tclancy commented 11 years ago

Test to show problem described in #22: Conditional Comments are getting partially escaped.

tclancy commented 11 years ago

How's this?

On Wed, Jun 19, 2013 at 2:33 PM, Tanner Netterville < notifications@github.com> wrote:

Let's simplify the test case to test only that < and > are not html ampersand escaped within comments.

— Reply to this email directly or view it on GitHubhttps://github.com/rennat/pynliner/pull/23#issuecomment-19704098 .

rennat commented 11 years ago

that will do nicely, merging it into my local to see if we can either fix it or compensate for another beautiful soup bug.

On Wed, Jun 19, 2013 at 4:53 PM, Tom Clancy notifications@github.comwrote:

How's this?

On Wed, Jun 19, 2013 at 2:33 PM, Tanner Netterville < notifications@github.com> wrote:

Let's simplify the test case to test only that < and > are not html ampersand escaped within comments.

— Reply to this email directly or view it on GitHub< https://github.com/rennat/pynliner/pull/23#issuecomment-19704098> .

— Reply to this email directly or view it on GitHubhttps://github.com/rennat/pynliner/pull/23#issuecomment-19717785 .

tclancy commented 11 years ago

If you want to point me at where to look, I'm happy to help. My problem (well, one of them) is it's been a decade since I've really worked with BS (e.g. writing a processor) and the syntax is just different enough it throws me off.

rennat commented 11 years ago

I've merged this in and added the ability to clean up after beautiful soup in this case.

It turns out this is just the behavior of BeautifulSoup and I didn't want to get into it's internals because eventually Pynliner will abandon BeautifulSoup as a requirement (it will be a big version jump.)

This is fixed but it is not an incredibly efficient process so it's disabled by default. To enable it just instantiate your Pynliner object with the keyword argument allow_conditional_comments=True.