From 96a4492e6706b9802aec9744db247395f1bf0cbd Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 16 Jun 2025 21:09:31 -0500 Subject: fix linkable rules and support nesting --- scripts/prepare_html_rules.py | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'scripts/prepare_html_rules.py') diff --git a/scripts/prepare_html_rules.py b/scripts/prepare_html_rules.py index aca29932..d2131b2a 100755 --- a/scripts/prepare_html_rules.py +++ b/scripts/prepare_html_rules.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 """Add ids to all rules based on their headline""" -# TODO: support nested lists import sys import re @@ -9,21 +8,6 @@ HEADER_RE = re.compile(r' str: """Extract the headline's number from it's data-number attribute""" m = DATA_NUMBER_RE.search(line) @@ -36,19 +20,20 @@ def extract_headline_nr(line: str) -> str: def main(): """Add ids to all ordered lists in the input""" headline = "" - i = 0 + items = [] for line in sys.stdin.readlines(): if HEADER_RE.match(line): headline = extract_headline_nr(line) h_idx = line.find('