more statuses & made posts linkable

This commit is contained in:
0x01fe committed 2024-06-24 16:05:04 -05:00
1 parent 471b223881
commit 11d54f4480
4 files changed
+38 -5

No files matched your search

+5 -1
View File
@@ -8,6 +8,8 @@ class Post:
date : datetime.datetime
body : str
file : str
title : str
url : str
def __init__(self, file_path):
self.file = file_path
@@ -17,9 +19,11 @@ class Post:
self.category = lines[1].split(":")[1].strip()
self.author = lines[2].split(":")[1].strip()
self.title = lines[6][2:-1]
self.url = '/post/' + self.title.replace(' ', '-')
date = lines[3].split(":")[1].strip()
self.date = datetime.datetime.strptime(date, "%d-%m-%Y")
self.body = markdown.markdown(''.join(lines[6:]))
self.body = markdown.markdown(f'# [{self.title}]({self.url})\n' + ''.join(lines[7:]))