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,9 +457,8 @@ class FlowSplitter(object):
|
|||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
self.files.append(self.base%i)
|
self.files.append(self.base%i)
|
||||||
for elem in root.xpath('//*[@id or @name]'):
|
for elem in root.xpath('//*[@id or @name]'):
|
||||||
anchor = elem.get('id', '')
|
for anchor in elem.get('id', ''), elem.get('name', ''):
|
||||||
if not anchor:
|
if anchor != '' and anchor not in self.anchor_map:
|
||||||
anchor = elem.get('name')
|
|
||||||
self.anchor_map[anchor] = self.files[-1]
|
self.anchor_map[anchor] = self.files[-1]
|
||||||
for elem in root.xpath('//*[@%s]'%SPLIT_POINT_ATTR):
|
for elem in root.xpath('//*[@%s]'%SPLIT_POINT_ATTR):
|
||||||
elem.attrib.pop(SPLIT_POINT_ATTR, '0')
|
elem.attrib.pop(SPLIT_POINT_ATTR, '0')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user