File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 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 ' )
You can’t perform that action at this time.
0 commit comments