From 50a1e6e66b900f3631fd8ebe9bced8b87d9a7cc0 Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Tue, 14 Sep 2021 16:44:30 +0000 Subject: [PATCH] Tune text draft reference extractor. Fixes #3404. Commit ready for merge. - Legacy-Id: 19363 --- ietf/utils/draft.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ietf/utils/draft.py b/ietf/utils/draft.py index 938b0148c..eb8dda4c1 100755 --- a/ietf/utils/draft.py +++ b/ietf/utils/draft.py @@ -36,6 +36,7 @@ COPYRIGHT +import debug # pyflakes: ignore import datetime import getopt @@ -1047,6 +1048,10 @@ class Draft(): # std at the front of a line can hide things like IEEE STD or MIL-STD std_start = re.compile( r'(?i)std\n*\b' ) + not_starting_regexes = [ + re.compile( r'(?i) uri references:?$' ), + ] + refs = {} in_ref_sect = False in_norm_ref_sect = False @@ -1064,11 +1069,12 @@ class Draft(): m = sectionre3.match( line ) if m: - in_ref_sect = True - refType = 'info' - if line.lower().find("normative") > 1: - in_norm_ref_sect = True - refType = 'norm' + if not any( [ rule.search( line ) for rule in not_starting_regexes ]): + in_ref_sect = True + refType = 'info' + if line.lower().find("normative") > 1: + in_norm_ref_sect = True + refType = 'norm' # might be subsections within a references section if in_ref_sect and not in_norm_ref_sect: