mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-06-20 09:04:42 +02:00
add series
This commit is contained in:
parent
630ff2da42
commit
3fea367e9a
11 changed files with 185 additions and 123 deletions
|
@ -477,6 +477,11 @@ if pandoc_runs_counter > 0 or run_gemini or force_html_regen:
|
|||
# else:
|
||||
# #print("Aucun article n'a été converti, la page d'index n'est pas régénérée")
|
||||
|
||||
# Ajouter le compteur de temps d'exécution
|
||||
print(f"\033[92mTemps d'exécution: {time.time() - start_time:.2f} secondes\033[0m")
|
||||
|
||||
|
||||
|
||||
|
||||
def generate_article_pages(json_file, template_file, output_dir):
|
||||
"""
|
||||
|
@ -499,7 +504,15 @@ def generate_article_pages(json_file, template_file, output_dir):
|
|||
print(f"articles count: {len(articles_info.values())}")
|
||||
# Générer les pages pour chaque article
|
||||
for article in articles_info.values():
|
||||
print('----------------------- article', article['title'])
|
||||
# print('----------------------- article', article['title'])
|
||||
|
||||
# Récupérer le nom de la série si l'article appartient à une série
|
||||
template_content['SERIE'] = None
|
||||
found_serie = get_series_name(article['slug'], args.blog)
|
||||
if found_serie:
|
||||
template_content['SERIE'] = website_config[args.blog]['SERIES'][found_serie]
|
||||
|
||||
|
||||
|
||||
if article['first_picture_url']:
|
||||
template_content['OG_IMAGE'] = article['first_picture_url']
|
||||
|
@ -520,22 +533,22 @@ def generate_article_pages(json_file, template_file, output_dir):
|
|||
slug_to_use = article['slug']
|
||||
# Construire le chemin de sortie html en fonction du slug avec l'année
|
||||
output_subdir = os.path.join(output_dir, slug_to_use)
|
||||
print(f"output_subdir: {output_subdir}")
|
||||
# print(f"output_subdir: {output_subdir}")
|
||||
os.makedirs(output_subdir, exist_ok=True)
|
||||
output_file = os.path.join(output_subdir ,"index.html")
|
||||
|
||||
print(f"output_file: {output_file}")
|
||||
# print(f"output_file: {output_file}")
|
||||
# Écrire le fichier de sortie en HTML pour un article
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
f.write(output_html)
|
||||
|
||||
print(f"Génération de la page gemini pour {article['title']}")
|
||||
if 'gemini_content' in article and len(article['gemini_content']) > 0:
|
||||
print(f"Génération de la page gemini pour {article['title']}")
|
||||
# Construire le chemin de sortie gmi en fonction du slug avec l'année
|
||||
save_gemini_file(args.blog, article, articles_info, template_content)
|
||||
counter_gemini += 1
|
||||
else:
|
||||
print(f"----------- on ne génère pas le gemini pour {article['slug']}")
|
||||
# else:
|
||||
# print(f"----------- on ne génère pas le gemini pour {article['slug']}")
|
||||
|
||||
print(f"\033[94m Nombre d'articles gemini générés : {counter_gemini}\033[0m")
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue