mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Output: Fix a duplicate id created in rare circumstances when splitting on page breaks. Fixes #1658744 [Duplicate ID error after converting from DOCX to EPUB](https://bugs.launchpad.net/calibre/+bug/1658744)
This commit is contained in:
parent
f8a2449d7f
commit
c85a3167e0
@ -254,7 +254,7 @@ class FlowSplitter(object):
|
||||
self.trees[i:i+1] = [before_tree, after_tree]
|
||||
break
|
||||
|
||||
trees, ids = [], set([])
|
||||
trees, ids = [], set()
|
||||
for tree in self.trees:
|
||||
root = tree.getroot()
|
||||
if self.is_page_empty(root):
|
||||
@ -267,10 +267,10 @@ class FlowSplitter(object):
|
||||
if ids:
|
||||
body = self.get_body(root)
|
||||
if body is not None:
|
||||
for x in ids:
|
||||
body.insert(0, body.makeelement(XHTML('div'),
|
||||
id=x, style='height:0pt'))
|
||||
ids = set([])
|
||||
existing_ids = frozenset(body.xpath('//*/@id'))
|
||||
for x in ids - existing_ids:
|
||||
body.insert(0, body.makeelement(XHTML('div'), id=x, style='height:0pt'))
|
||||
ids = set()
|
||||
trees.append(tree)
|
||||
self.trees = trees
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user