mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-06-20 09:04:42 +02:00
move on index build and linking previous and next articles
This commit is contained in:
parent
7d221d970a
commit
16b93f380e
1711 changed files with 231792 additions and 838 deletions
|
@ -52,6 +52,7 @@ def open_latest_posts_content(config_title):
|
|||
# le nom de fichier org commence par une date YYYY-MM-DD ou bien YYYYMMDDHHmmss, est suivie d'un slug, et finit par l'extension .org
|
||||
|
||||
def generer_index(dossier_source, fichier_index):
|
||||
|
||||
# Chemin absolu du dossier parent (pour sauver le fichier d'index)
|
||||
dossier_parent = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
@ -82,6 +83,7 @@ def generer_index(dossier_source, fichier_index):
|
|||
|
||||
contenu_index_html += f"<div class='latest-articles'>{content_posts_list}</div>"
|
||||
|
||||
files_fr.sort(reverse=True)
|
||||
# ----------- indexer les articles en Français ------------------
|
||||
for fichier in files_fr:
|
||||
# date_string, année, slug = find_year_and_slug(fichier)
|
||||
|
@ -89,6 +91,9 @@ def generer_index(dossier_source, fichier_index):
|
|||
contenu_index_gmi += f"=> {fichier}\n"
|
||||
link_html = fichier.replace('.gmi', '.html')
|
||||
chemin_fichier_this_article_html = chemin_dossier_source + '/lang_fr/converted/' + link_html
|
||||
if not os.path.exists(chemin_fichier_this_article_html):
|
||||
print(f"!!!!!!!!!!!!!!! Le fichier HTML {chemin_fichier_this_article_html} n'existe pas.")
|
||||
continue
|
||||
|
||||
link_org = fichier.replace('.gmi', '.org')
|
||||
file_path_org = os.path.join(dossier_parent, "sources", website_name, lang_folder, link_org)
|
||||
|
@ -153,7 +158,7 @@ def generer_index(dossier_source, fichier_index):
|
|||
print('chemin_fichier_index_html', chemin_fichier_index_html)
|
||||
print(' ')
|
||||
with open(chemin_fichier_index_html, 'w', encoding='utf-8') as file:
|
||||
print('contenu_index_html', contenu_index_html)
|
||||
# print('contenu_index_html', contenu_index_html)
|
||||
# contenu_index_html = enrich_one_file(contenu_index_html)
|
||||
file.write(contenu_index_html)
|
||||
print(f" ------------ build_indexes: Fichier d'index '{chemin_fichier_index_html}' généré avec succès.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue