From 95171ee221ec35c3c2c586fa55199e1390b182d3 Mon Sep 17 00:00:00 2001 From: waldek Date: Tue, 7 Mar 2023 09:50:59 +1100 Subject: [PATCH] adds a last updated header to the markdown files --- jetforce/app/static_md.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetforce/app/static_md.py b/jetforce/app/static_md.py index 1f9670f..b1f97dc 100644 --- a/jetforce/app/static_md.py +++ b/jetforce/app/static_md.py @@ -113,8 +113,11 @@ class StaticMarkdownDirectoryApplication(StaticDirectoryApplication): return Response(Status.SUCCESS, mimetype, generator) def _load_md_file(self, filesystem_path: pathlib.Path) -> typing.Iterator[bytes]: + timestamp = os.path.getmtime(filesystem_path) + date = datetime.datetime.fromtimestamp(timestamp) + gemini = "last modified: {}\n".format(date) with filesystem_path.open("r") as fp: - gemini = md2gemini.md2gemini(fp.read(), links="paragraph") + gemini += md2gemini.md2gemini(fp.read(), links="paragraph") gemini = gemini.encode() chunks = int(len(gemini) / self.CHUNK_SIZE) + 1 for i in range(chunks):