diff --git a/generate.py b/generate.py index a563529..d8291ef 100644 --- a/generate.py +++ b/generate.py @@ -146,20 +146,21 @@ def render_gemini_index(): def render_gemini_places(): post_paths = glob(md_dir + "*") + template = template_environment.get_template("gemini_place") for post_path in post_paths: post_name = path.basename(post_path).split('/')[-1][:-3] with open(post_path, "r") as f: content = f.read() process = Popen(["gemgen"], stdout=PIPE, stdin=PIPE, stderr=PIPE, text=True) + gemtext = process.communicate(input=content)[0] + gemtext_with_local_urls = name_from_url.sub(sub_http_local_urls, gemtext) with open(gemini_out_dir + post_name + ".gmi", "w") as f: - header = f"""=> / Index -## {metadata[post_name]["title"]}, {metadata[post_name]["state"]} -=> https://helixnebula.space/{post_name}/ Link to photography. - -""" - gemtext = process.communicate(input=content)[0] - gemtext_with_local_urls = name_from_url.sub(sub_http_local_urls, gemtext) - f.write(header + gemtext_with_local_urls) + f.write(template.render({ + "post_code": post_name, + "post_body": gemtext_with_local_urls, + "post_title": metadata[post_name]["title"], + "state": metadata[post_name]["state"] + })) def copy_files(): call("cp js/* html/js/", shell=True) diff --git a/templates/gemini_main b/templates/gemini_main index ddb2f8c..ea216cc 100644 --- a/templates/gemini_main +++ b/templates/gemini_main @@ -4,7 +4,7 @@ I have spent countless hours dedicated to enjoying and capturing the natural won ## Gemspace Info -This is my gemspace, where I share stories from my travels. My posts from the http version of helixnebula.space are mirrored here. The http version also includes a very large amount of photography for these locations and more. Here on this space, you will find the stories I have written for those albums. More of these posts will be written with time, so check back later to see if there is more. +This is my gemspace, where I share stories from my travels. My text posts from the http version of helixnebula.space are mirrored here. The http version also includes a very large amount of photography for these locations and more. Here on this gemspace, you will find the stories I have written for those albums. More of these posts will be written with time, so check back later to see if there is more. => https://helixnebula.space/ View my photography site! diff --git a/templates/gemini_place b/templates/gemini_place new file mode 100644 index 0000000..be962c5 --- /dev/null +++ b/templates/gemini_place @@ -0,0 +1,6 @@ +=> / Index +### {{ post_title }}, {{ state }} + +=> https://helixnebula.space/{{ post_code }}/ Link to photography. + +{{ post_body }} \ No newline at end of file