From db7b1c7d8bba0d7f8fd31344b4e6c1e3c79e36f6 Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Wed, 12 Aug 2026 22:38:36 +1200 Subject: [PATCH 1/2] fix(bibxml): Improve author name processing --- ietf/sync/bibxml.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ietf/sync/bibxml.py b/ietf/sync/bibxml.py index ddfabdd74c..96e6c1400a 100644 --- a/ietf/sync/bibxml.py +++ b/ietf/sync/bibxml.py @@ -98,6 +98,11 @@ } +CHUNK = r"(?:[A-Z]|\([A-Z]+\))+" +INITIAL = rf"(?:{CHUNK}-)*{CHUNK}\." +NAME_RE = re.compile(rf"^\s*(?P(?:{INITIAL}[-\s]*)*)(?P.*?)\s*$") + + class BibXMLException(Exception): pass @@ -153,7 +158,9 @@ def get_rfc_bibxml(rfc): ) else: try: - initials, surname = author.titlepage_name.split(maxsplit=1) + name_parts = NAME_RE.match(author.titlepage_name) + initials = name_parts["initials"].strip() + surname = name_parts["surname"] if author.is_editor: author_entry = f"""""" else: From 98980a157e78af540cdf2d0a30896de80c7c42e7 Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Thu, 13 Aug 2026 09:50:14 +1200 Subject: [PATCH 2/2] fix(bibxml): More improvements --- ietf/sync/bibxml.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ietf/sync/bibxml.py b/ietf/sync/bibxml.py index 96e6c1400a..18e72d81c1 100644 --- a/ietf/sync/bibxml.py +++ b/ietf/sync/bibxml.py @@ -99,7 +99,11 @@ CHUNK = r"(?:[A-Z]|\([A-Z]+\))+" -INITIAL = rf"(?:{CHUNK}-)*{CHUNK}\." +PARENY = r"[A-Z]*(?:\([A-Z]+\)[A-Z]*)+" +DOTTED = rf"(?:{CHUNK}-)*{CHUNK}\." +BARE = rf"(?:{PARENY}|[A-Z]+)(?=[-\s])" +INITIAL = rf"(?:{DOTTED}|{BARE})" + NAME_RE = re.compile(rf"^\s*(?P(?:{INITIAL}[-\s]*)*)(?P.*?)\s*$") @@ -161,10 +165,13 @@ def get_rfc_bibxml(rfc): name_parts = NAME_RE.match(author.titlepage_name) initials = name_parts["initials"].strip() surname = name_parts["surname"] + initials_attr = "" + if initials: + initials_attr = f"initials={qa(initials)}" if author.is_editor: - author_entry = f"""""" + author_entry = f"""""" else: - author_entry = f"""""" + author_entry = f"""""" except ValueError: # Case where author has single name. author_entry = f""""""