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