more statuses & made posts linkable
This commit is contained in:
1 parent
471b223881
commit
11d54f4480
4 files changed
+38
-5
No files matched your search
+5
-1
@@ -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:]))
|
||||
|
||||
Reference in new issue
Block a user