mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02: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
1 changed files with 3 additions and 4 deletions
|
|
@ -457,10 +457,9 @@ def commit(self):
|
|||
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…
Reference in a new issue