generate tags pages with jinja template

This commit is contained in:
Tykayn 2025-02-20 15:31:44 +01:00 committed by tykayn
parent 8e32423dce
commit 367c7754c6
8 changed files with 178 additions and 42 deletions

View file

@ -58,10 +58,15 @@ for file_name in os.listdir(directory):
if isinstance(tags, set):
tags = list(tags)
boom = basename.split('__')
# Convertir le contenu Org en HTML
title = find_first_level1_title(content)
# Convertir le contenu Org en HTML
html_content = pypandoc.convert_text(content, 'html', format='org')
# Désactiver les warning d'identifiant dupliqué dans la conversion pandoc
content_without_h1 = re.sub(r'^\*.*?$', '', content, count=1, flags=re.MULTILINE)
html_content = pypandoc.convert_text(content_without_h1, 'html', format='org')
# html_content = pypandoc.convert_text(content, 'html', format='org')
files_dict[f"{annee}/{slug}"] = {
'path': file_path,
@ -186,8 +191,6 @@ def generate_article_pages(json_file, template_file, output_dir):
with open(output_file, 'w', encoding='utf-8') as f:
f.write(output_html)
# print(f"Page générée pour l'article {article['title']} dans {output_file}")
# Appel de la fonction pour générer les pages des articles
generate_article_pages(destination_json + '/articles_info.json', 'templates/html/article.html.jinja', destination_html)