diff options
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index c704182..864f1b2 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -81,20 +81,23 @@ def set_trip_id(year, seq): tid= f"{year}_s{seq:02d}" return tid +rx_tripperson = re.compile(r'(?i)<u>(.*?)</u>$') +rx_round_bracket = re.compile(r"[\(\[].*?[\)\]]") + def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): res = [ ] author = None - round_bracket_regex = re.compile(r"[\(\[].*?[\)\]]") #print(f'# {tid}') for tripperson in re.split(r",|\+|&|&(?!\w+;)| and ", trippeople): tripperson = tripperson.strip() - mul = re.match(r"<u>(.*?)</u>$(?i)", tripperson) + # 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(round_bracket_regex, "", tripperson).strip() + tripperson = re.sub(rx_round_bracket, "", tripperson).strip() if tripperson =="Wiggy": tripperson = "Phil Wigglesworth" @@ -134,6 +137,7 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_ DataIssue.objects.create(parser='logbooks', message=message) logdataissues["title"]=message print(message) + raise return if not author: |