From d4c90ebe46e461d7969a921901eda7f06d5d7741 Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Fri, 27 Oct 2023 09:18:47 +1300 Subject: [PATCH] fix: Avoid duplicate index entries --- xml2rfc/writers/preptool.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xml2rfc/writers/preptool.py b/xml2rfc/writers/preptool.py index c5ffb908..88e3cc07 100644 --- a/xml2rfc/writers/preptool.py +++ b/xml2rfc/writers/preptool.py @@ -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 = [] @@ -1428,7 +1430,7 @@ def get_anchor(parent): if not anchor: self.err(e, "Did not find an anchor to use for 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')