From dd411f636fa6c061484f9c7669cfe94afc32c884 Mon Sep 17 00:00:00 2001 From: JohnD Date: Sat, 21 Sep 2024 14:15:13 -0400 Subject: [PATCH] * doc/mkqhcp.py: v1.0.4: include appendix and index in contents --- doc/mkqhcp.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/mkqhcp.py b/doc/mkqhcp.py index 2cbee5b..f4a8fc0 100755 --- a/doc/mkqhcp.py +++ b/doc/mkqhcp.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 ## mkqhcp.py -## Version 1.0.3 +## Version 1.0.4 ## Copyright 2022-2023 John Donoghue ## @@ -51,13 +51,21 @@ def process(name): title = e.group("title") break + # section h2_match = re.compile(r'.*

]*>(?P[^<]+)</h2>.*') + # appendix + h2a_match = re.compile(r'.*<h2 class="appendix"[^>]*>(?P<title>[^<]+)</h2>.*') + # index + h2i_match = re.compile(r'.*<h2 class="unnumbered"[^>]*>(?P<title>[^<]+)</h2>.*') + h3_match = re.compile(r'.*<h3 class="section"[^>]*>(?P<title>[^<]+)</h3>.*') h4_match = re.compile(r'.*<h4 class="subsection"[^>]*>(?P<title>[^<]+)</h4>.*') tag_match1 = re.compile(r'.*<span id="(?P<tag>[^"]+)"[^>]*></span>.*') #tag_match2 = re.compile(r'.*<div class="[sub]*section" id="(?P<tag>[^"]+)"[^>]*>.*') tag_match2 = re.compile(r'.*<div class="[sub]*section[^"]*" id="(?P<tag>[^"]+)"[^>]*>.*') tag_match3 = re.compile(r'.*<div class="chapter-level-extent" id="(?P<tag>[^"]+)"[^>]*>.*') + tag_match4 = re.compile(r'.*<div class="appendix-level-extent" id="(?P<tag>[^"]+)"[^>]*>.*') + tag_match5 = re.compile(r'.*<div class="unnumbered-level-extent" id="(?P<tag>[^"]+)"[^>]*>.*') index_match = re.compile(r'.*<h4 class="subsection"[^>]*>[\d\.\s]*(?P<name>[^<]+)</h4>.*') tag = "top" @@ -82,10 +90,18 @@ def process(name): e = tag_match2.match(line) if not e: e = tag_match3.match(line) + if not e: + e = tag_match4.match(line) + if not e: + e = tag_match5.match(line) if e: tag = e.group("tag") e = h2_match.match(line) + if not e: + e = h2a_match.match(line) + if not e: + e = h2i_match.match(line) if e: if has_h3: f.write(' </section>\n')