Fix #788570 (Calibre Epub to Mobi does not handle hidden spans correctly)

This commit is contained in:
Kovid Goyal 2011-05-26 10:58:48 -06:00
parent ea0920053f
commit 5744242319

View File

@ -297,9 +297,11 @@ class MobiMLizer(object):
if id_: if id_:
# Keep anchors so people can use display:none # Keep anchors so people can use display:none
# to generate hidden TOCs # to generate hidden TOCs
tail = elem.tail
elem.clear() elem.clear()
elem.text = None elem.text = None
elem.set('id', id_) elem.set('id', id_)
elem.tail = tail
else: else:
return return
tag = barename(elem.tag) tag = barename(elem.tag)
@ -309,7 +311,8 @@ class MobiMLizer(object):
istates.append(istate) istates.append(istate)
left = 0 left = 0
display = style['display'] display = style['display']
isblock = not display.startswith('inline') isblock = (not display.startswith('inline') and style['display'] !=
'none')
isblock = isblock and style['float'] == 'none' isblock = isblock and style['float'] == 'none'
isblock = isblock and tag != 'br' isblock = isblock and tag != 'br'
if isblock: if isblock: