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:
Kovid Goyal 2009-08-20 09:10:28 -06:00
parent bdb0da92f8
commit 5ab558aca6

View File

@ -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')