+ {{ article.title }} +
Index des tags - {{template_content['BLOG_TITLE']}} + +
+{{template_content['BLOG_SUBTITLE']}}
++ Tags +
+ + ++ + + +
diff --git a/gather_tags_in_json.py b/gather_tags_in_json.py index b812d52a..621e6475 100644 --- a/gather_tags_in_json.py +++ b/gather_tags_in_json.py @@ -2,22 +2,24 @@ import argparse import json from collections import defaultdict +from jinja2 import Environment, FileSystemLoader +import json from utils import * from website_config import * parser = argparse.ArgumentParser(description="Générer un site Web à partir de fichiers HTML.") -parser.add_argument("blog_name", help="Le chemin vers le dossier contenant les fichiers HTML.") +parser.add_argument("blog", help="Le chemin vers le dossier contenant les fichiers HTML.") args = parser.parse_args() # Configuration -blog_folder = args.blog_name +blog_folder = args.blog directory_base = f'sources/{blog_folder}' # Remplacez par le chemin de votre dossier directory_fr = f'{directory_base}/lang_fr' # Remplacez par le chemin de votre dossier output_file = f'sources/{blog_folder}/converted/tags.json' # Fichier de sortie html_output_folder = f'html-websites/{blog_folder}/tag' # Dossier de sortie pour les fichiers HTML html_output_folder_index = f'html-websites/{blog_folder}/tags' # Dossier de sortie pour les fichiers HTML -excluded_tags = {'PROPERTIES', 'CREATED', 'ID', 'END'} +excluded_tags = {'PROPERTIES', 'CREATED', 'ID', 'END', 'CUSTOM_ID'} automatic_tagging_enabled = global_config['automatic_tagging_enabled'] count_not_tagged_files = 0 @@ -100,31 +102,34 @@ def generate_html_pages_for_all_tags(tag_to_files, html_output_folder): def generate_index_page(tag_to_files, html_output_folder): - index_content = f""" -
- - - """ + print(tags_count) + + # Préparer les données pour le template + data = { + 'tags': tags_count, + 'template_content' : template_content, + 'html_output_folder': html_output_folder + } + + # Rendre le template avec les données + output_html = template.render(data) os.makedirs(os.path.dirname(html_output_folder_index), exist_ok=True) index_file_path = os.path.join(html_output_folder_index, "index.html") with open(index_file_path, 'w', encoding='utf-8') as index_file: - index_file.write(index_content) + index_file.write(output_html) print(f"Page d'index générée dans {index_file_path}") @@ -140,4 +145,4 @@ if __name__ == "__main__": print(f"Tags et fichiers associés ont été enregistrés dans {output_file}") print(f"Pages HTML générées dans {html_output_folder}") - # print(f"Pages non tagguées: {count_not_tagged_files}") # TODO + print(f"Pages non tagguées: {count_not_tagged_files}") diff --git a/html-websites/dragonfeu_blog/2024/strategie-mitigation-accident-fusion-coeur-epr2/index.html b/html-websites/dragonfeu_blog/2024/strategie-mitigation-accident-fusion-coeur-epr2/index.html index dc141d77..2dbde845 100644 --- a/html-websites/dragonfeu_blog/2024/strategie-mitigation-accident-fusion-coeur-epr2/index.html +++ b/html-websites/dragonfeu_blog/2024/strategie-mitigation-accident-fusion-coeur-epr2/index.html @@ -576,18 +576,18 @@ href="https://medium.com/tag/fukushima?source=post_page-----f82c1d15ed58-------- - logiciel + art entreprise - AI - - art - bd cours + AI + + logiciel + @@ -603,7 +603,7 @@ href="https://medium.com/tag/fukushima?source=post_page-----f82c1d15ed58-------- Article suivant: - + diff --git a/html-websites/dragonfeu_blog/index.html b/html-websites/dragonfeu_blog/index.html index 8796bab6..b8a7229c 100644 --- a/html-websites/dragonfeu_blog/index.html +++ b/html-websites/dragonfeu_blog/index.html @@ -83,7 +83,7 @@ @@ -97,10 +97,11 @@ 29 January 2025 à 14:35:36https://placehold.co/600x400/png
coin coin
https://placehold.co/600x400/png
+lorem bla bla