mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Prefer name to id when they differ during splitting. Also use first rather than last occurrence of an id.
This commit is contained in:
parent
bdb0da92f8
commit
5ab558aca6
@ -457,10 +457,9 @@ class FlowSplitter(object):
|
||||
root = tree.getroot()
|
||||
self.files.append(self.base%i)
|
||||
for elem in root.xpath('//*[@id or @name]'):
|
||||
anchor = elem.get('id', '')
|
||||
if not anchor:
|
||||
anchor = elem.get('name')
|
||||
self.anchor_map[anchor] = self.files[-1]
|
||||
for anchor in elem.get('id', ''), elem.get('name', ''):
|
||||
if anchor != '' and anchor not in self.anchor_map:
|
||||
self.anchor_map[anchor] = self.files[-1]
|
||||
for elem in root.xpath('//*[@%s]'%SPLIT_POINT_ATTR):
|
||||
elem.attrib.pop(SPLIT_POINT_ATTR, '0')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user