2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

bugfix - hack

This commit is contained in:
Philip Sargent 2023-10-22 21:28:38 +03:00
parent 1641dfe5f1
commit 8f87e4f77a

View File

@ -340,7 +340,8 @@ def parser_html(year, expedition, txt, seq=""):
\s whitespace
\S NOT whitespace
You can't see it here, but a round-trip export-then-import will move
You can't see it here, but a round-trip export-then-import
for a new year logbook will move
the endmatter up to the frontmatter. This made sense when translating
from parser_html_01 format logfiles, believe me.
"""
@ -351,11 +352,12 @@ def parser_html(year, expedition, txt, seq=""):
headmatch = re.match(r"(?i)(?s).*<body[^>]*>(.*?)<hr.*", txt)
headpara = headmatch.groups()[0].strip()
#print(f" - headpara:\n'{headpara}'")
if len(headpara) > 0:
frontpath = Path(settings.EXPOWEB, LOGBOOKS_DIR, year, "frontmatter.html")
with open(frontpath, "w") as front:
front.write(headpara + "\n")
if not frontpath.is_file:
# dont attempt to rewrite it. So this will only run once, for new logbook. Buggy otherwise.
with open(frontpath, "w") as front:
front.write(headpara + "\n")
# extract END material and stash for later use when rebuilding from list of entries
endmatch = re.match(r"(?i)(?s).*<hr\s*/>([\s\S]*?)(?=</body)", txt)