Fix #2904 (created epub from odt file, tested in epubcheck, errors on images)

This commit is contained in:
Kovid Goyal 2009-07-27 11:58:49 -06:00
parent 74875fff97
commit 7a3db36c9a

View File

@ -64,4 +64,15 @@ class ODTInput(InputFormatPlugin):
accelerators): accelerators):
return Extract()(stream, '.') return Extract()(stream, '.')
def postprocess_book(self, oeb, opts, log):
# Fix <p><div> constructs as the asinine epubchecker complains
# about them
from calibre.ebooks.oeb.base import XPath, XHTML
path = XPath('//h:p/h:div')
for item in oeb.spine:
root = item.data
if not hasattr(root, 'xpath'): continue
for div in path(root):
div.getparent().tag = XHTML('div')