vladris / tinkerer

Python blogging engine
https://vladris.com/tinkerer
Other
305 stars 81 forks source link

iframe in a raw directive breaks the home page #71

Closed sgillies closed 10 years ago

sgillies commented 10 years ago

I'm using

.. raw:: html

   <iframe frameborder="0" width="100%" height="300" src="http://bl.ocks.org/d/dcfe6ce4e7fa7b2e00e9"></iframe>

In a post. The post's own page converts to HTML (--build or --preview) with no problems, but the home page is broken. Everything after the iframe is dropped.

vladris commented 10 years ago

This looks like an upstream bug. Tinkerer runs each post page through PyQuery to patch some relative links and other stuff. Looks like in the process, <iframe ...></iframe> gets turned into <iframe />. This seems to be the reason browser doesn't read this correctly. There is no particular logic for dealing with iframes, so this is either PyQuery or lxml issue that it collapses open and closed tags into a single one. I'll dig some more into it if I have time to spare, but I doubt I can locally fix it in Tinkerer...

vladris commented 10 years ago

Looks like this happens with any open/closed tags with no content. On the other hand, there seems to be a simple fix: just add a space between the iframe tags. The parser will consider it as content and it will no longer collapse them into a single tag.

I'll Won't Fix this issue since there is a simple workaround and it's an upstream problem anyway.

sgillies commented 10 years ago

@vladris thanks for the workaround recommendation!