Fixed renderContents on BeautifilSoup if there is no body in source html
authorgibus
Thu, 09 Aug 2012 16:55:25 +0200
changeset 459 a69421197502
parent 458 ba7e05582435
child 460 2fdb7d095d5c
Fixed renderContents on BeautifilSoup if there is no body in source html
src/cm/converters/pandoc_converters.py
--- a/src/cm/converters/pandoc_converters.py	Thu Aug 09 13:05:11 2012 +0200
+++ b/src/cm/converters/pandoc_converters.py	Thu Aug 09 16:55:25 2012 +0200
@@ -223,7 +223,8 @@
       stdoutdata = (content.encode('utf8'))
       soup = BeautifulSoup(stdoutdata)
       body = soup.body
-      stdoutdata = body.renderContents()
+      if body:
+        stdoutdata = body.renderContents()
       # strip leading spaces
       stdoutdata = re.sub(r"^\s+", '', stdoutdata)
       # add new line before closing bracket