diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 9502147..11cd70f 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -59,21 +59,11 @@ BLOG_PARSER_SETTINGS = { } DEFAULT_LOGBOOK_FILE = "logbook.html" DEFAULT_LOGBOOK_PARSER = "parser_html" -# All years since 2010 use the default value for Logbook parser -LOGBOOK_PARSER_SETTINGS = { - "2019": ("logbook.html", "parser_html"), - "2010": ("logbook.html", "parser_html"), +# All years since 2002 use the default value for Logbook parser +LOGBOOK_PARSER_SETTINGS = { # "2009": ("2009logbook.txt", "wiki_parser"), # converted to html # "2008": ("2008logbook.txt", "wiki_parser"), # converted to html - "2009": ("logbook.html", "parser_html"), - "2008": ("logbook.html", "parser_html"), - "2007": ("logbook.html", "parser_html"), - "2006": ("logbook.html", "parser_html"), # "2006": ("logbook/logbook_06.txt", "wiki_parser"), # converted to html - "2006": ("logbook.html", "parser_html"), - "2005": ("logbook.html", "parser_html"), - "2004": ("logbook.html", "parser_html"), - "2003": ("logbook.html", "parser_html"), "2002": ("logbook.html", "parser_html"), "2001": ("log.htm", "parser_html_01"), "2000": ("log.htm", "parser_html_01"), @@ -136,6 +126,7 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): if tripperson and tripperson[0] != '*': tripperson = re.sub(rx_round_bracket, "", tripperson).strip() + # these aliases should be moved to people.py GetPersonExpeditionNameLookup(expedition) if tripperson =="Wiggy": tripperson = "Phil Wigglesworth" if tripperson =="Animal": @@ -148,6 +139,8 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): tripperson = "Rob Watson" if tripperson =="Tinywoman": tripperson = "Nadia" + if tripperson =="tcacrossley": + tripperson = "Tom Crossley" personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower()) @@ -296,51 +289,6 @@ def ParseDate(tripdate, year): DataIssue.objects.create(parser='logbooks', message=message) logdataissues["tripdate"]=message return datetime.date(1970, 1, 1) - -# # (2006 - not any more), 2008 - 2009 -# def wiki_parser(year, expedition, txt, seq=""): - # global logentries - # global logdataissues - - # logbook_entry_count = 0 - # trippara = re.findall(r"===(.*?)===([\s\S]*?)(?====)", txt) - # for triphead, triptext in trippara: - # logbook_entry_count += 1 - # tid = set_trip_id(year,logbook_entry_count) - - # tripheadp = triphead.split("|") - # if not (len(tripheadp) == 3): - # message = " ! - Bad no of items in tripdate in logbook: " + tripdate + " - " + tripheadp - # DataIssue.objects.create(parser='logbooks', message=message) - # logdataissues["tripdate"]=message - - # tripdate, tripplace, trippeople = tripheadp - # tripsplace = tripplace.split(" - ") - # tripcave = tripsplace[0].strip() - # if len(tripsplace) == 1: - # tripsplace = tripsplace[0] - # else: - # tripsplace = tripsplace[1] - - - # #tul = re.findall(r"T/?U:?\s*(\d+(?:\.\d*)?|unknown)\s*(hrs|hours)?", triptext) - # tul = re.findall(r"T/U:?\s*(\d+[.]?\d*)\s*(hr|hrs|hours)?.*", triptext) - # if tul: - # tu = tul[0][0] - # else: - # tu = "" - # print(f"! LOGBOOK {year} {logbook_entry_count:2} {len(triptext):4} T/U:{tu} '{tripcave} - {tripsplace}' ") - - # ldate = ParseDate(tripdate.strip(), year) - # tripid = set_trip_id(year,logbook_entry_count) - - # ltriptext = re.sub(r"\n", "

\n", triptext) - # ltriptext = ltriptext.replace("

\n

\n","

\n") - - # triptitle = f'{tripcave} - {tripsplace}' - # entrytuple = (ldate, tripcave, triptitle, ltriptext, - # trippeople, expedition, tu, tripid) - # logentries.append(entrytuple) # 2002, 2004 - now def parser_html(year, expedition, txt, seq=""): diff --git a/templates/logbookentry.html b/templates/logbookentry.html index 7ddbf05..8a68c36 100644 --- a/templates/logbookentry.html +++ b/templates/logbookentry.html @@ -13,7 +13,7 @@

{% if logbookentry.cave %} -

place: {{logbookentry.place}}

+

place: {{logbookentry.place|safe}}

{% else %}

{{logbookentry.place|safe}}

{% endif %} @@ -31,7 +31,7 @@ CaverT/UPrevNext {% for persontrip in logbookentry.persontrip_set.all %} - {% if persontrip.personexpedition == logbookentry.author %} + {% if persontrip.is_logbook_entry_author %} {% else %} @@ -64,6 +64,7 @@
{{logbookentry.date|date:"D d M Y"}} + {% for persontrip in logbookentry.persontrip_set.all %}{% if persontrip.is_logbook_entry_author %}
{{persontrip.personexpedition.person}}{% endif %}{% endfor %}

{{logbookentry.text|safe}}