2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 21:57:09 +00:00

fix more twiddly variations of QMs

This commit is contained in:
2023-03-18 03:03:06 +00:00
parent d64948749e
commit 5a90e7b727
5 changed files with 59 additions and 32 deletions

View File

@@ -147,20 +147,32 @@ def parse_KH_QMs(kh, inputFile, ticked):
# <dt><a href="sibria.htm#qC1997-161-27" name="C1997-161-27">C1997-161-27</a> A<dd>Sib: pitch at end of Fuzzy Logic [Paradox Rift - continues] [sep.fuzzy.13]
line += 1
res = re.search(
r"name=\"[CB](?P<year>\d*)-(?P<cave>\d*)-(?P<number>\d*).*</a>\s*(?P<grade>[ABCDX?V])<dd>(?P<location_description>.*)(\[(?P<station_name>.*)\])?",
r"name=\"[CB](?P<year>\d*)-(?P<cave>\d*)-(?P<number>\d*).*</a>\s*(?P<grade>[ABCDX?V])<dd>(?P<location_description>[^[]*)(\[\s*(?P<completion>[^]]*)\s*\])?\s*(\[\s*(?P<station_name>[^]]*)\s*\])?",
dataline,
)
if res:
res = res.groupdict()
year = int(res["year"])
completion = res["completion"]
station_name = res["station_name"]
if not completion and station_name:
if station_name.startswith("<a href"):
completion = station_name
station_name = ""
if completion and not station_name:
if not ticked:
station_name = completion
if completion:
completion = completion.replace("<a href=\"","<a href=\"/1623/161/")
nearest_station_name = ""
resolution_station_name = ""
if res["station_name"]:
if station_name:
if ticked:
resolution_station_name = res["station_name"].replace("<a href=\"","<a href=\"/1623/161/")
resolution_station_name = station_name.replace("<a href=\"","<a href=\"/1623/161/")
else:
nearest_station_name = res["station_name"]
nearest_station_name = station_name.replace("<a href=\"","<a href=\"/1623/161/")
lookupAttribs = {
#'found_by':placeholder,
"blockname": "",
@@ -172,7 +184,7 @@ def parse_KH_QMs(kh, inputFile, ticked):
nonLookupAttribs = {
"ticked": ticked,
"page_ref": "",
"completion_description": "",
"completion_description": completion,
"nearest_station_name": nearest_station_name,
"resolution_station_name": resolution_station_name,
"location_description": res["location_description"].replace("<a href=\"","<a href=\"/1623/161/"),