* prefix documented

This commit is contained in:
Philip Sargent 2023-02-02 15:40:50 +00:00
parent 9abfcdd091
commit 13f0c6f988

View File

@ -119,22 +119,27 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
for tripperson in re.split(r",|\+|&|&(?!\w+;)| and ", trippeople):
tripperson = tripperson.strip()
# mul = re.match(r"(?i)<u>(.*?)</u>$", tripperson)
mul = rx_tripperson.match(tripperson)
if mul:
tripperson = mul.group(1).strip()
if tripperson and tripperson[0] != "*":
tripperson = re.sub(rx_round_bracket, "", tripperson).strip()
# author_u = re.match(r"(?i)<u>(.*?)</u>$", tripperson)
author_u = rx_tripperson.match(tripperson)
if author_u:
tripperson = author_u.group(1).strip()
if tripperson:
if tripperson[0] != "*": # a name prefix of "*" is special
tripperson = re.sub(rx_round_bracket, "", tripperson).strip()
# Whacky aliases all handled in GetPersonExpeditionNameLookup()
personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower())
if not personyear:
message = f" ! - {expedition.year} No name match for: '{tripperson}' in entry {tid=} for this expedition year."
print(message)
DataIssue.objects.create(parser="logbooks", message=message)
res.append((personyear, logtime_underground))
if mul:
author = personyear
# Whacky aliases all handled in GetPersonExpeditionNameLookup()
personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower())
if not personyear:
message = f" ! - {expedition.year} No name match for: '{tripperson}' in entry {tid=} for this expedition year."
print(message)
DataIssue.objects.create(parser="logbooks", message=message)
res.append((personyear, logtime_underground))
if author_u:
author = personyear
else:
# a person but with * prefix. Ignored everywhere.
print(f" ! - {expedition.year} * person : {tripperson}")
if not author:
if not res:
return "", 0
@ -160,7 +165,7 @@ def tidy_time_underground(logtime_underground):
logtime_underground = 0
return logtime_underground
def tidy_trip_persons(trippeople, expedition, logtime_underground, tid):
def tidy_trip_persons(trippeople, title, expedition, logtime_underground, tid):
try:
trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground, tid=tid)
# print(f" - {author} - {logtime_underground}")
@ -372,7 +377,7 @@ def parser_html(year, expedition, txt, seq=""):
dupl[check] = 1
tu = tidy_time_underground(tu)
trippersons, author = tidy_trip_persons(trippeople, expedition, tu, tid)
trippersons, author = tidy_trip_persons(trippeople, triptitle, expedition, tu, tid)
tripcave = tidy_trip_cave(place)
tripcontent = tidy_trip_image_urls(tripcontent, ldate)
tid = tidy_tid(tid, triptitle)