Skip to content

Commit

Permalink
fix: Avoid duplicate index entries
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara committed Oct 26, 2023
1 parent 49e5d87 commit d4c90eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xml2rfc/writers/preptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@

index_item = namedtuple('index_item', ['item', 'sub', 'anchor', 'anchor_tag', 'iref', ])

re_spaces = re.compile(r'\s+')

def uniq(l):
seen = set()
ll = []
Expand Down Expand Up @@ -1428,7 +1430,7 @@ def get_anchor(parent):
if not anchor:
self.err(e, "Did not find an anchor to use for <iref item='%s'> in <%s>" % (item, p.tag))
else:
self.index_entries.append(index_item(item, sub, anchor, anchor_tag, e))
self.index_entries.append(index_item(re_spaces.sub(' ', item), sub, anchor, anchor_tag, e))

def ol_add_counter(self, e, p):
start = e.get('start')
Expand Down

0 comments on commit d4c90eb

Please sign in to comment.