This commit is contained in:
Philip Sargent 2022-08-25 16:12:13 +03:00
parent 760abe1a9e
commit 79672dd4b3

View File

@ -317,9 +317,10 @@ def Parseloghtmltxt(year, expedition, txt):
\s*(?:<div\s+class="timeug">\s*(.*?)</div>)?
\s*$
''', trippara)
tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups()
if not s: # allow title and people to be swapped in order
s = re.match(r'''(?x)(?:\s*<div\sclass="tripdate"\sid=".*?">.*?</div>\s*<p>)? # second date
if s:
tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups()
else: # allow title and people to be swapped in order
s2 = re.match(r'''(?x)(?:\s*<div\sclass="tripdate"\sid=".*?">.*?</div>\s*<p>)? # second date
\s*(?:<a\s+id="(.*?)"\s*/>\s*</a>)?
\s*<div\s+class="tripdate"\s*(?:id="(.*?)")?>(.*?)</div>(?:<p>)?
\s*<div\s+class="triptitle">\s*(.*?)</div>
@ -328,15 +329,15 @@ def Parseloghtmltxt(year, expedition, txt):
\s*(?:<div\s+class="timeug">\s*(.*?)</div>)?
\s*$
''', trippara)
tripid, tripid1, tripdate, triptitle, trippeople, triptext, tu = s.groups()
if not s:
if not re.search(r"Rigging Guide", trippara):
msg = " !- Logbook. Can't parse: {} entry:{}".format(trippara, logbook_entry_count)
print(msg)
DataIssue.objects.create(parser='logbooks', message=msg)
logdataissues[tid]=msg
continue
if s2:
tripid, tripid1, tripdate, triptitle, trippeople, triptext, tu = s2.groups()
else:
if not re.search(r"Rigging Guide", trippara):
msg = " !- Logbook. Can't parse: {} entry:{}".format(trippara, logbook_entry_count)
print(msg)
DataIssue.objects.create(parser='logbooks', message=msg)
logdataissues[tid]=msg
continue
ldate = ParseDate(tripdate.strip(), year)
triptitles = triptitle.split(" - ")