Fix #897531 (epub output do not add xml:lang from lang attribute)

This commit is contained in:
Kovid Goyal 2011-11-29 11:25:11 +05:30
parent 4cb1907a13
commit 2e5f38a5bc

View File

@ -132,9 +132,11 @@ class EPUBOutput(OutputFormatPlugin):
def upshift_markup(self): # {{{
'Upgrade markup to comply with XHTML 1.1 where possible'
from calibre.ebooks.oeb.base import XPath
from calibre.ebooks.oeb.base import XPath, XML
for x in self.oeb.spine:
root = x.data
if (not root.get(XML('lang'))) and (root.get('lang')):
root.set(XML('lang'), root.get('lang'))
body = XPath('//h:body')(root)
if body:
body = body[0]