diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py
index 4ddf1f7915..b207ac4dcb 100644
--- a/src/calibre/ebooks/epub/output.py
+++ b/src/calibre/ebooks/epub/output.py
@@ -17,6 +17,34 @@ from calibre.customize.conversion import OptionRecommendation
from lxml import etree
+block_level_tags = (
+ 'address',
+ 'body',
+ 'blockquote',
+ 'center',
+ 'dir',
+ 'div',
+ 'dl',
+ 'fieldset',
+ 'form',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'hr',
+ 'isindex',
+ 'menu',
+ 'noframes',
+ 'noscript',
+ 'ol',
+ 'p',
+ 'pre',
+ 'table',
+ 'ul',
+ )
+
class EPUBOutput(OutputFormatPlugin):
@@ -217,39 +245,41 @@ class EPUBOutput(OutputFormatPlugin):
Perform various markup transforms to get the output to render correctly
in the quirky ADE.
'''
- from calibre.ebooks.oeb.base import XPNSMAP, XHTML, OEB_STYLES
- from lxml.etree import XPath as _XPath
- from functools import partial
- XPath = partial(_XPath, namespaces=XPNSMAP)
+ from calibre.ebooks.oeb.base import XPath, XHTML, OEB_STYLES, barename
for x in self.oeb.spine:
root = x.data
body = XPath('//h:body')(root)
if body:
body = body[0]
+
# Replace
that are children of