Fixed adding ASCII art when posting from .gmi file.

This commit is contained in:
= 2022-06-02 22:50:21 +05:30
parent 29a9bd5056
commit 67c4b13b0a
1 changed files with 8 additions and 2 deletions

10
gempost
View File

@ -227,8 +227,14 @@ def newpost(title, existing_content = None):
postHeader = ""
if modified: # add content to file using the existing_content list instead of opening editor
with open(f"{wdir+filename}.gmi", 'w') as o:
o.writelines(existing_content)
if (ch != 'n' or ch != 'N'):
with open(f"{wdir}blogpostHeader.gmi") as a: # loading post header
postHeader = a.readlines()
with open(f"{wdir+filename}.gmi", 'w') as o:
o.writelines(postHeader + existing_content)
else:
with open(f"{wdir+filename}.gmi", 'w') as o:
o.writelines(existing_content)
else:
temp = "# " + title
exec(f'echo "{temp}" | cat >> {wdir + filename}.gmi') # adding title to empty file