try a bit of this
This commit is contained in:
parent
2903f691cd
commit
100005d00c
12
geminer.py
12
geminer.py
|
@ -134,8 +134,6 @@ for dirname, subdirlist, mdlist in os.walk('.'):
|
||||||
with open(gmi_subpath+"/"+gmifile, 'w') as gmi:
|
with open(gmi_subpath+"/"+gmifile, 'w') as gmi:
|
||||||
gmi.write(gmitext)
|
gmi.write(gmitext)
|
||||||
|
|
||||||
posts.sort(key=lambda p: p["date"], reverse=True)
|
|
||||||
|
|
||||||
# Generate home page
|
# Generate home page
|
||||||
with open(tpl_path+"/index.tpl", 'r') as tpl:
|
with open(tpl_path+"/index.tpl", 'r') as tpl:
|
||||||
template = Template(tpl.read())
|
template = Template(tpl.read())
|
||||||
|
@ -143,6 +141,7 @@ text = template.render(posts=posts)
|
||||||
with open(meta_path+"/index.gmi", 'w') as gmi:
|
with open(meta_path+"/index.gmi", 'w') as gmi:
|
||||||
gmi.write(text)
|
gmi.write(text)
|
||||||
|
|
||||||
|
# Generate custom meta pages
|
||||||
for prop_dict in config.index_props:
|
for prop_dict in config.index_props:
|
||||||
prop = prop_dict["property"]
|
prop = prop_dict["property"]
|
||||||
if "index_name" in prop_dict:
|
if "index_name" in prop_dict:
|
||||||
|
@ -156,7 +155,7 @@ for prop_dict in config.index_props:
|
||||||
template = Template(tpl.read())
|
template = Template(tpl.read())
|
||||||
for item in posts_prop_index[prop]:
|
for item in posts_prop_index[prop]:
|
||||||
text = template.render(prop_item=posts_prop_index[prop][item])
|
text = template.render(prop_item=posts_prop_index[prop][item])
|
||||||
with open(meta_path+"/"+prop_dict.get("item_dir", prop)+"/"+posts_prop_index[prop][item]+".gmi") as gmi:
|
with open(meta_path+"/"+prop_dict.get("item_dir", prop)+"/"+item+".gmi") as gmi:
|
||||||
gmi.write(text)
|
gmi.write(text)
|
||||||
|
|
||||||
# Generate posts list page
|
# Generate posts list page
|
||||||
|
@ -165,10 +164,3 @@ with open(tpl_path+"/posts_list.tpl", 'r') as tpl:
|
||||||
text = template.render(posts=posts)
|
text = template.render(posts=posts)
|
||||||
with open(meta_path+"/posts.gmi", 'w') as gmi:
|
with open(meta_path+"/posts.gmi", 'w') as gmi:
|
||||||
gmi.write(text)
|
gmi.write(text)
|
||||||
|
|
||||||
## Generate tags list page
|
|
||||||
#with open(tpl_path+"/tags_list.tpl", 'r') as tpl:
|
|
||||||
# template = Template(tpl.read())
|
|
||||||
#text = template.render(tags=tags)
|
|
||||||
#with open(meta_path+"/tags.gmi", 'w') as gmi:
|
|
||||||
# gmi.write(text)
|
|
||||||
|
|
Loading…
Reference in New Issue