Skip to content

Commit dd411f6

Browse files
committed
* doc/mkqhcp.py: v1.0.4: include appendix and index in contents
1 parent a7aea22 commit dd411f6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

doc/mkqhcp.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python3
22

33
## mkqhcp.py
4-
## Version 1.0.3
4+
## Version 1.0.4
55

66
## Copyright 2022-2023 John Donoghue
77
##
@@ -51,13 +51,21 @@ def process(name):
5151
title = e.group("title")
5252
break
5353

54+
# section
5455
h2_match = re.compile(r'.*<h2 class="chapter"[^>]*>(?P<title>[^<]+)</h2>.*')
56+
# appendix
57+
h2a_match = re.compile(r'.*<h2 class="appendix"[^>]*>(?P<title>[^<]+)</h2>.*')
58+
# index
59+
h2i_match = re.compile(r'.*<h2 class="unnumbered"[^>]*>(?P<title>[^<]+)</h2>.*')
60+
5561
h3_match = re.compile(r'.*<h3 class="section"[^>]*>(?P<title>[^<]+)</h3>.*')
5662
h4_match = re.compile(r'.*<h4 class="subsection"[^>]*>(?P<title>[^<]+)</h4>.*')
5763
tag_match1 = re.compile(r'.*<span id="(?P<tag>[^"]+)"[^>]*></span>.*')
5864
#tag_match2 = re.compile(r'.*<div class="[sub]*section" id="(?P<tag>[^"]+)"[^>]*>.*')
5965
tag_match2 = re.compile(r'.*<div class="[sub]*section[^"]*" id="(?P<tag>[^"]+)"[^>]*>.*')
6066
tag_match3 = re.compile(r'.*<div class="chapter-level-extent" id="(?P<tag>[^"]+)"[^>]*>.*')
67+
tag_match4 = re.compile(r'.*<div class="appendix-level-extent" id="(?P<tag>[^"]+)"[^>]*>.*')
68+
tag_match5 = re.compile(r'.*<div class="unnumbered-level-extent" id="(?P<tag>[^"]+)"[^>]*>.*')
6169
index_match = re.compile(r'.*<h4 class="subsection"[^>]*>[\d\.\s]*(?P<name>[^<]+)</h4>.*')
6270

6371
tag = "top"
@@ -82,10 +90,18 @@ def process(name):
8290
e = tag_match2.match(line)
8391
if not e:
8492
e = tag_match3.match(line)
93+
if not e:
94+
e = tag_match4.match(line)
95+
if not e:
96+
e = tag_match5.match(line)
8597
if e:
8698
tag = e.group("tag")
8799

88100
e = h2_match.match(line)
101+
if not e:
102+
e = h2a_match.match(line)
103+
if not e:
104+
e = h2i_match.match(line)
89105
if e:
90106
if has_h3:
91107
f.write(' </section>\n')

0 commit comments

Comments
 (0)