From bfb5c22059c31f120cf132e164102d6c3921eaab Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 2 Jun 2022 00:02:23 +0530 Subject: [PATCH] minor changes. --- README.md | 2 +- gempost | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 094a6a3..d075361 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ proceed with the given steps. Wih only your *index.gmi* file in **public_gemini/** directory, run the following to set everyting up: `gempost init` -Note that `gempost init` won't work if you don't have gempost added to your path. For tildeverse members, you can just copy the executable to you **~/bin/** directory. Otherwise, you can just do `./gempost ` instead of `gempost `. +Note that `gempost init` won't work if you don't have gempost added to your path. For tildeverse members, you can just copy the executable to your **~/bin/** directory. Otherwise, you can just do `./gempost ` instead of `gempost `. **STEP 2** Skip this if you chose to initialize an *index.gmi* during `gempost init`. diff --git a/gempost b/gempost index 054b83d..4eecd69 100755 --- a/gempost +++ b/gempost @@ -25,7 +25,7 @@ default_post_page_header = """ wdir = f"/home/{getlogin()}/public_gemini/" # working/main directory postDir = wdir + "postdir/" # all post files along with the archive.gmi are stored here indexFile = wdir + "postIndex" # the index is maintained in this file -editor = "nano" +editor = "nano --restricted -t" def checkInit(): """ Checks if the public_gemini/ directory has been initialized for use with gempost or is missing some files. """ @@ -60,7 +60,7 @@ def rebuildReferences(filename = None, title = None, callingFrom = "default"): headerText = [] try: - with open(f"{wdir}postPageHeader.gmi",'r') as h: # the file postPageHeader should be defined by the user in {wdir}. It should contain the user's custom post page header + with open(f"{wdir}postPageHeader.gmi",'r') as h: # the file postPageHeader.gmi should be defined by the user in {wdir}. It should contain the user's custom post page header headerText = h.readlines() except FileNotFoundError: # If user hasn't created that file, a default line "# posts" is added to posts.gmi headerText.append(default_post_page_header) @@ -125,7 +125,7 @@ def newpost(title, existing_content = None): try: with open(f"{wdir}blogpostHeader.gmi") as a: # checking if header for each post has been defined postHeader = a.readlines() - postHeader.append(' ') + #postHeader.append('\n') with open(f"{wdir + filename}.gmi",'w') as f: f.writelines(postHeader) except FileNotFoundError: @@ -135,8 +135,8 @@ def newpost(title, existing_content = None): with open(f"{wdir+filename}.gmi", 'w') as o: o.writelines(existing_content) else: - temp = "# " + title # adding title to empty file - exec(f'echo "{temp}" | cat >> {wdir + filename}.gmi') + temp = "# " + title + exec(f'echo "{temp}" | cat >> {wdir + filename}.gmi') # adding title to empty file exec(f"{editor} {wdir+filename}.gmi") # opening editor @@ -162,7 +162,7 @@ def newpost(title, existing_content = None): exec(f"chmod 745 {wdir}posts.gmi") exec(f"chmod 745 {wdir}postdir && chmod 745 {wdir}postdir/*") - prGreen("\nYour post is live!") # yay? + prGreen("\n Your post is live!") # yay? def manage(): allposts = [] # storing all indexFile entries inside a list @@ -173,7 +173,7 @@ def manage(): return 0 postsList = [] - for i in allposts: + for i in allposts: # creating a list containing titles corresponding to filenames postsList.append([i[56:-1],i[11:51]]) print() # line break @@ -275,7 +275,7 @@ Directory Structure: ├── posts.gmi └── trash/ - 2 directories, 4 files + 2 directories, 5 files - "postdir/" is where all your gemlog posts are stored. - "postIndex" is the file that gempost uses to maintain an index of your posts. @@ -331,7 +331,7 @@ elif (arg == "post"): else: print("\nAfter entering a title, an editor will be launched for you to write your blog post.") - print("The process will continue after you save your post (Ctrl+S) and exit the editor (Ctrl+X).") + print("The process will continue after you exit the editor (Ctrl+X).") title = input("\nPOST TITLE: ") if (len(title) == 0): prRed("Post title cannot be empty.") @@ -351,7 +351,7 @@ elif (arg == "purge"): # permanently delete trashed posts prGreen("Trash cleared.") elif (arg == "init"): # initialize public_gemini/ for use with gempost - if (len(listdir(f"{wdir}")) <= 1): + if (len(listdir(f"{wdir}")) <= 1): exec(f"touch {wdir}postIndex && mkdir {wdir}postdir/ {wdir}trash/ && chmod 745 {wdir}* && chmod 700 {wdir}trash/") ch = input("Also create index.gmi ? (y/[n]) ") if (ch == 'y' or ch == 'Y'):