diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-02-02 15:40:50 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-02-02 15:40:50 +0000 |
commit | 13f0c6f9886e121be2dc94607b67b60d5aae1d68 (patch) | |
tree | e74fb59fc1a6aa95b9f66632e5257b57c750a65b /parsers/logbooks.py | |
parent | 9abfcdd0914c6b6b2c52fbe93cc4bb9eae79d7c9 (diff) | |
download | troggle-13f0c6f9886e121be2dc94607b67b60d5aae1d68.tar.gz troggle-13f0c6f9886e121be2dc94607b67b60d5aae1d68.tar.bz2 troggle-13f0c6f9886e121be2dc94607b67b60d5aae1d68.zip |
* prefix documented
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 4d26448..a8469e1 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -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() - - # 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 + # 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 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) |