16 lines
626 B
Python
Executable File
16 lines
626 B
Python
Executable File
import config
|
|
from datetime import datetime
|
|
|
|
def parse_post_format(post, record, username):
|
|
post = post.replace("%S", config.post_seperator)
|
|
post = post.replace("%T", record[2])
|
|
post = post.replace("%D", datetime.strptime(str(record[4]),"%d%m%YZ%H%M%ST").strftime(config.date_format))
|
|
post = post.replace("%E", datetime.strptime(str(record[5]),"%d%m%YZ%H%M%ST").strftime(config.date_format))
|
|
post = post.replace("%C", record[3])
|
|
post = post.replace("%L", f"{config.site_url}/post/{record[0]}.gmi")
|
|
post = post.replace("%U", f"{config.site_url}/user/{username}.gmi")
|
|
post = post.replace("%N", username)
|
|
|
|
return post
|
|
|