**the next generation**
This commit is contained in:
parent
e31c69fe18
commit
fdbe22df04
12
generate.py
12
generate.py
@ -12,7 +12,6 @@ import datetime
|
||||
|
||||
numbers_re = re.compile("[0-9]+")
|
||||
name_from_url_re = re.compile(r"https:\/\/helixnebula.space/(.*)/")
|
||||
md_links_re = re.compile(r"\[([^\]]*)\]\([^\)]*\)")
|
||||
out_dir = "/var/www/html/"
|
||||
gemini_out_dir = "/var/gemini/"
|
||||
base_url = "https://helixnebula.space/"
|
||||
@ -95,11 +94,7 @@ def render_index():
|
||||
data = {key: value for key, value in sorted(metadata.items(), key=lambda item: item[1]['title'])}
|
||||
photo_counts = {placename: metadata[placename]["count"] for placename in metadata.keys()}
|
||||
total_count = 0
|
||||
posts = [
|
||||
path.basename(post).split('/')[-1][:-3] for post in
|
||||
glob(md_dir + "*")
|
||||
]
|
||||
posts.sort()
|
||||
posts = sorted(story_names, key=lambda x: metadata[x]["story_time"], reverse=True)
|
||||
for _, info in metadata.items():
|
||||
total_count = info["count"] + total_count
|
||||
with open(out_dir + "index.html", "w") as f:
|
||||
@ -152,10 +147,11 @@ def sub_http_local_urls(match):
|
||||
|
||||
def render_gemini_index():
|
||||
template = template_environment.get_template("gemini_main")
|
||||
stories = [(post_code, metadata[post_code]) for post_code in story_names]
|
||||
stories.sort(key=lambda i: i[1]["story_time"], reverse=True)
|
||||
with open(gemini_out_dir + "index.gmi", "w") as f:
|
||||
f.write(template.render({
|
||||
"post_info": {post_name: metadata[post_name]["title"] for post_name in story_names},
|
||||
"post_states": {post_name: metadata[post_name]["state"] for post_name in story_names}
|
||||
"story_data": stories
|
||||
}))
|
||||
|
||||
def render_gemini_places():
|
||||
|
@ -116,7 +116,8 @@
|
||||
"ElMalpais": {
|
||||
"title": "El Malpais National Monument",
|
||||
"state": "New Mexico",
|
||||
"cover": "IMG_9669.JPEG"
|
||||
"cover": "IMG_9669.JPEG",
|
||||
"story_time": 1744493210
|
||||
},
|
||||
"CibolaGrants": {
|
||||
"title": "Cibola National Forest Near Grants",
|
||||
@ -142,7 +143,8 @@
|
||||
"VLA": {
|
||||
"title": "Very Large Array",
|
||||
"state": "New Mexico",
|
||||
"cover": "IMG_6644.JPEG"
|
||||
"cover": "IMG_6644.JPEG",
|
||||
"story_time": 1744419715
|
||||
},
|
||||
"Phoenix": {
|
||||
"title": "Phoenix",
|
||||
|
@ -8,7 +8,26 @@ This is my gemspace, where I share stories from my travels. My text posts from t
|
||||
|
||||
=> https://helixnebula.space/ View my photography site!
|
||||
|
||||
## Posts
|
||||
```
|
||||
, ' . ' ,
|
||||
. . ' . ,
|
||||
. ' +
|
||||
+ .-'''''-.
|
||||
.' `. + . ________||
|
||||
___ : : | / || . '___
|
||||
____/ \ : : ||. _/ || ||\_______/ \
|
||||
/ \ : _/| : `|| __/ ,.|| || \
|
||||
/ , ' . \ : =/_/ : |'_______ || || || . \
|
||||
| \__`._/ | .' ___| \__ \\|| ||... , \
|
||||
l|, ' ( / ,|...-' \ ' , __\||_//___
|
||||
___|____ \_/^\/||__ , . ,__ ||// \ . ,
|
||||
_/~ `""~`"` \_ ''( ....,||/ '
|
||||
..,... __/ -'/ `-._ `\_\__ | \ || _______ .
|
||||
itz/jgs/ccm'` `\ \ \-.\ /(_1_,.. || /
|
||||
______/""""
|
||||
```
|
||||
|
||||
{% for post_name, post_title in post_info.items() %}=> {{ post_name }}.gmi {{ post_title }}, {{ post_states[post_name] }}
|
||||
## Posts (ordered by most recent)
|
||||
|
||||
{% for story_code, metadata in story_data %}=> {{ story_code }}.gmi {{ metadata["title"] }}, {{ metadata["state"] }}
|
||||
{% endfor %}
|
||||
|
@ -42,6 +42,7 @@
|
||||
</details>
|
||||
<details class="toc">
|
||||
<summary class="tocText">Albums With Stories</summary>
|
||||
<span>Ordered by most recent first.</span>
|
||||
{% for placename in posts %}
|
||||
<div class="tocEntry">
|
||||
<a class="tocLink" href="/{{ placename }}">{{ metadata[placename]['title'] }}, {{ metadata[placename]['state'] }} [{{ metadata[placename]['count'] }}]</a>
|
||||
@ -50,6 +51,7 @@
|
||||
</details>
|
||||
<p class="notices" xmlns:cc="http://creativecommons.org/ns#" >Photos licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY-NC-SA 4.0<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" alt=""><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" alt=""><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1" alt=""><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1" alt=""></a>
|
||||
<br>Powered by <a href="https://git.tilde.town/nebula/helixnebula.space">free, open source software</a>
|
||||
<br><a href="gemini://helixnebula.space">Available via Gemini protocol</a>
|
||||
<br><a href="https://helixnebula.space/feeds.html">Subscribe with your feed reader!</a>
|
||||
</p>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user