Fix ordering and naming of App A

This commit is contained in:
Nick Touran 2025-11-28 16:07:55 -05:00
parent 7d09eaecb7
commit 9332337581

View file

@ -93,7 +93,7 @@ def process_10cfr50_app_a():
def process(line):
line = re.sub(r"\((\d+)\)", r"\1.", line)
line = re.sub(r"\((.+)\)", r", \1,", line)
line = re.sub(r"\((.+?)\)", r", \1,", line)
return line
needs_lines = [".. list2need::", " :types: req, req, req", ""]
@ -105,7 +105,9 @@ def process_10cfr50_app_a():
if re.search(r"^[A-Z]+\. [A-Z]", line):
LOG.info("Reading %s", line)
elif match := re.search(r"^Criterion (\d+)—(.+?)\.(.+)", line):
num = match.group(1).strip()
num = int(match.group(1).strip())
if num == 34:
breakpoint()
title = match.group(2).strip()
subnum = 1
LOG.info(
@ -113,18 +115,18 @@ def process_10cfr50_app_a():
match.group(1).strip(),
match.group(2).strip(),
)
needs_lines.append(f" * (R_GDC_{num}){process(title)}")
needs_lines.append(f" * (R_GDC_{num:02d}){process(title)}")
sentences = tokenize.tokenize_sentences(match.group(3).strip())
for sent in sentences:
needs_lines.append(
f" * (R_GDC_{num}_{subnum}){process(sent.strip())}"
f" * (R_GDC_{num:02d}_{subnum:02d}){process(sent.strip())}"
)
subnum += 1
else:
sentences = tokenize.tokenize_sentences(line)
for sent in sentences:
needs_lines.append(
f" * (R_GDC_{num}_{subnum}){process(sent.strip())}"
f" * (R_GDC_{num:02d}_{subnum:02d}){process(sent.strip())}"
)
subnum += 1