From 7b12ef533bc83b254d895cecc9f96ee74f3c2651 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Thu, 27 Mar 2025 13:37:26 +0100 Subject: [PATCH] templates up --- gather_tags_in_json.py | 4 +- linking_articles_prev_next.py | 4 +- .../{article.html.jinja => article.html.j2} | 34 +------------- .../html/{index.html.jinja => index.html.j2} | 0 templates/html/masthead.j2 | 1 + templates/html/site_head.html.j2 | 34 ++++++++++++++ templates/html/site_head.html.jinja | 20 --------- .../{static.html.jinja => static.html.j2} | 0 .../html/{tag.html.jinja => tag.html.j2} | 0 templates/styles_src/style_general.scss | 44 +------------------ 10 files changed, 42 insertions(+), 99 deletions(-) rename templates/html/{article.html.jinja => article.html.j2} (69%) rename templates/html/{index.html.jinja => index.html.j2} (100%) create mode 100644 templates/html/masthead.j2 create mode 100644 templates/html/site_head.html.j2 delete mode 100644 templates/html/site_head.html.jinja rename templates/html/{static.html.jinja => static.html.j2} (100%) rename templates/html/{tag.html.jinja => tag.html.j2} (100%) diff --git a/gather_tags_in_json.py b/gather_tags_in_json.py index ea7ceddb..43d4f6a3 100644 --- a/gather_tags_in_json.py +++ b/gather_tags_in_json.py @@ -108,7 +108,7 @@ def generate_html_pages_for_all_tags(tag_to_files, html_output_folder): # Charger le template Jinja2 env = Environment(loader=FileSystemLoader('.')) - template = env.get_template('templates/html/tag.html.jinja') + template = env.get_template('templates/html/tag.html.j2') sorted_tags = sorted(tag_to_files.items()) for tag, files in tag_to_files.items(): @@ -141,7 +141,7 @@ def generate_index_page(tag_to_files, html_output_folder): # Charger le template Jinja2 env = Environment(loader=FileSystemLoader('.')) - template = env.get_template('templates/html/tag.html.jinja') + template = env.get_template('templates/html/tag.html.j2') sorted_tags = sorted(tag_to_files.items()) tags_count = {tag: len(files) for tag, files in sorted_tags} diff --git a/linking_articles_prev_next.py b/linking_articles_prev_next.py index a5d77ec3..5542e4c0 100644 --- a/linking_articles_prev_next.py +++ b/linking_articles_prev_next.py @@ -466,7 +466,7 @@ Dernière mise à jour: {dt.datetime.now().strftime('%Y-%m-%d, %H:%M:%S')} # Générer la page d'index seulement si des articles ont été convertis if pandoc_runs_counter > 0 or run_gemini or force_html_regen: # Appel de la fonction pour générer la page d'index - generate_blog_index(destination_json + '/articles_info.json', 'templates/html/index.html.jinja', destination_html + 'index.html') + generate_blog_index(destination_json + '/articles_info.json', 'templates/html/index.html.j2', destination_html + 'index.html') print(f"\033[94m index régénéré {destination_html}index.html \033[0m") # else: @@ -547,7 +547,7 @@ def generate_article_pages(json_file, template_file, output_dir): # if pandoc_runs_counter or run_gemini: # 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) +generate_article_pages(destination_json + '/articles_info.json', 'templates/html/article.html.j2', destination_html) # À la fin du script, calculer et afficher le temps d'exécution execution_time = time.time() - start_time diff --git a/templates/html/article.html.jinja b/templates/html/article.html.j2 similarity index 69% rename from templates/html/article.html.jinja rename to templates/html/article.html.j2 index 79bcddc2..6e27ecf0 100644 --- a/templates/html/article.html.jinja +++ b/templates/html/article.html.j2 @@ -1,40 +1,10 @@ - - - - - - - - - - - - - - - - {{ article.title | safe }} -{{template_content['TITLE']}} - - - - - - - - - - - - - - +{% include 'site_head.j2' %} +