summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2022-12-19 00:33:32 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2022-12-19 00:33:32 +0000
commit43a98b4421a2be343007bcf6722982cf8c86370f (patch)
tree5c41c05b6b69c55ef016537a16946c68627b8046
parentf1d5df9933b23a8fdc55005f7ea44d5c8fd96094 (diff)
downloadtroggle-43a98b4421a2be343007bcf6722982cf8c86370f.tar.gz
troggle-43a98b4421a2be343007bcf6722982cf8c86370f.tar.bz2
troggle-43a98b4421a2be343007bcf6722982cf8c86370f.zip
Not quite getting all the blog post contents
-rw-r--r--parsers/imports.py2
-rw-r--r--parsers/logbooks.py16
-rw-r--r--templates/logbook2005style.html2
3 files changed, 12 insertions, 8 deletions
diff --git a/parsers/imports.py b/parsers/imports.py
index 825f46c..a253964 100644
--- a/parsers/imports.py
+++ b/parsers/imports.py
@@ -41,7 +41,7 @@ def import_logbooks():
with transaction.atomic():
troggle.parsers.logbooks.LoadLogbooks()
-def import_logbook(year=2009):
+def import_logbook(year=2022):
print(f"-- Importing Logbook {year}")
print(f"-- - commented out")
with transaction.atomic():
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 11cd70f..aa4ec92 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -52,10 +52,10 @@ data for old logbooks. New design needed, with a mechanism for flagging fixtures
'''
MAX_LOGBOOK_ENTRY_TITLE_LENGTH = 200
BLOG_PARSER_SETTINGS = {
-# "2017": ("ukcavingblog.html", "parser_blog"), # now folded in to logbooks.html
- "2018": ("ukcavingblog.html", "parser_blog"),
+# "2022": ("ukcavingblog.html", "parser_blog"),
"2019": ("ukcavingblog.html", "parser_blog"),
- "2022": ("ukcavingblog.html", "parser_blog"),
+ "2018": ("ukcavingblog.html", "parser_blog"),
+# "2017": ("ukcavingblog.html", "parser_blog"), # now folded in to logbooks.html
}
DEFAULT_LOGBOOK_FILE = "logbook.html"
DEFAULT_LOGBOOK_PARSER = "parser_html"
@@ -86,7 +86,7 @@ LOGBOOK_PARSER_SETTINGS = {
"1982": ("log.htm", "parser_html_01"),
}
-entries = { "2022": 64, "2019": 56, "2018": 75, "2017": 76, "2016": 81, "2015": 79,
+entries = { "2022": 86, "2019": 56, "2018": 86, "2017": 76, "2016": 83, "2015": 79,
"2014": 65, "2013": 51, "2012": 75, "2011": 68, "2010": 22, "2009": 53,
"2008": 49, "2007": 113, "2006": 60, "2005": 55, "2004": 76, "2003": 42, "2002": 31,
"2001": 48, "2000": 54, "1999": 79, "1998": 43, "1997": 53, "1996": 95, "1995": 42,
@@ -510,7 +510,7 @@ def parser_blog(year, expedition, txt, sq=""):
tu = 0
logbook_entry_count = 0
for i in range(0, len(tripparas)):
- trippara = tripparas[i]
+ tripcontent = tripparas[i]
triphead = tripheads[i]
logbook_entry_count += 1
tid = set_trip_id(year,logbook_entry_count) +"_blog" + sq
@@ -550,7 +550,11 @@ def parser_blog(year, expedition, txt, sq=""):
# tripname must have the location then a hyphen at the beginning as it is ignored by export function
location = "Unknown"
tripname = f"Expo - UK Caving Blog{sq} post {logbook_entry_count}" # must be unique for a given date
- tripcontent = f"\n\nBlog Author: {trippeople}" + trippara
+ tripcontent = re.sub(r"(width=\"\d+\")","",tripcontent)
+ tripcontent = re.sub(r"height=\"\d+\"","",tripcontent)
+ tripcontent = re.sub(r"width: \d+px","",tripcontent)
+ tripcontent = re.sub(r"\n\n+","\n\n",tripcontent)
+ tripcontent = f"\n\nBlog Author: {trippeople}" + tripcontent
entrytuple = (tripdate, location, tripname, tripcontent,
trippeople, expedition, tu, tid)
diff --git a/templates/logbook2005style.html b/templates/logbook2005style.html
index 7831175..bf5534c 100644
--- a/templates/logbook2005style.html
+++ b/templates/logbook2005style.html
@@ -13,7 +13,7 @@ maintain half a dozen parser functions.
Sorry about all the crap that surrounds the image tags which has been imported along with the content
when UK Caving blogs have been parsed.
-Exported on {% now 'Y-m-d D' %} using control panel webpage and exportlogbook() in troggle/code/views/other.py
+Exported on {% now 'Y-m-d H:m' %} using control panel webpage and exportlogbook() in troggle/code/views/other.py
-->
<body>
{%for logbook_entry in logbook_entries%}