adds a last updated header to the markdown files

This commit is contained in:
waldek 2023-03-07 09:50:59 +11:00
parent 77ea6079de
commit 95171ee221
1 changed files with 4 additions and 1 deletions

View File

@ -113,8 +113,11 @@ class StaticMarkdownDirectoryApplication(StaticDirectoryApplication):
return Response(Status.SUCCESS, mimetype, generator) return Response(Status.SUCCESS, mimetype, generator)
def _load_md_file(self, filesystem_path: pathlib.Path) -> typing.Iterator[bytes]: 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: with filesystem_path.open("r") as fp:
gemini = md2gemini.md2gemini(fp.read(), links="paragraph") gemini += md2gemini.md2gemini(fp.read(), links="paragraph")
gemini = gemini.encode() gemini = gemini.encode()
chunks = int(len(gemini) / self.CHUNK_SIZE) + 1 chunks = int(len(gemini) / self.CHUNK_SIZE) + 1
for i in range(chunks): for i in range(chunks):