From 92676366874fb2991922d117de529d2d2fc48979 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Tue, 12 Nov 2024 00:55:21 +0100 Subject: [PATCH] variabilize blog params --- WIP/website_config.py | 12 - build_indexes.py | 2 + enrich_html.py | 83 ++--- gemini-capsules/tykayn_blog/a-propos.gmi | 7 + gemini-capsules/tykayn_blog/accueil.gmi | 7 + gemini-capsules/tykayn_blog/blogroll.gmi | 7 + gemini-capsules/tykayn_blog/contact.gmi | 5 + .../tykayn_blog/footer-articles.gmi | 7 + gemini-capsules/tykayn_blog/index.gmi | 15 + ...0925100118_tkblog_861_dotclear-s-parti.gmi | 40 +++ ...42_tkblog_456_salut-patrick-xkcd-style.gmi | 28 ++ .../lang_fr/20211211215731-krita.gmi | 70 ++++ .../20241111235943-sketches_de_toulouse.gmi | 21 ++ .../lang_fr/20241112000047-sketches_18.gmi | 15 + .../20241112000229-illus_mono_couleurs.gmi | 18 ++ .../lang_fr/20241112000537-kinktober_2023.gmi | 19 ++ .../lang_fr/20241112000653-calin_yuri_ah.gmi | 25 ++ ...2000757-conseils_de_pratique_du_dessin.gmi | 45 +++ .../20241112000852-essais_en_cabine.gmi | 32 ++ ...41112001001-la_fougue_dans_les_rideaux.gmi | 29 ++ ...de_partage_des_sources_d_illustrations.gmi | 36 +++ ..._evaluer_la_ligne_politique_d_un_media.gmi | 68 ++++ gemini-capsules/tykayn_blog/projets.gmi | 7 + .../index.html | 300 ------------------ .../index.html | 262 --------------- .../2021/20211211215731-krita/index.html | 30 +- .../index.html | 42 +-- .../index.html => a-propos.html} | 52 +-- html-websites/tykayn_blog/accueil.html | 174 ++++++++++ .../tykayn_blog/blogroll.html | 23 +- html-websites/tykayn_blog/contact.html | 173 ++++++++++ .../tykayn_blog/footer-articles.html | 175 ++++++++++ html-websites/tykayn_blog/index.html | 29 +- .../tykayn_blog/index_tykayn_blog.html | 26 -- .../tykayn_blog/projets.html | 61 +--- html-websites/tykayn_blog/style.css | 122 +++++-- sources/tykayn_blog/converted/a-propos.html | 5 +- sources/tykayn_blog/converted/accueil.html | 5 +- sources/tykayn_blog/converted/blogroll.html | 5 +- sources/tykayn_blog/converted/contact.html | 5 +- .../converted/footer-articles.html | 5 +- sources/tykayn_blog/converted/index.html | 5 +- sources/tykayn_blog/converted/projets.html | 5 +- .../20241111235943-sketches_de_toulouse.org | 17 + .../lang_fr/20241112000047-sketches_18.org | 12 + .../20241112000229-illus_mono_couleurs.org | 17 + .../lang_fr/20241112000537-kinktober_2023.org | 17 + .../lang_fr/20241112000653-calin_yuri_ah.org | 16 + ...2000757-conseils_de_pratique_du_dessin.org | 33 ++ .../20241112000852-essais_en_cabine.org | 22 ++ ...41112001001-la_fougue_dans_les_rideaux.org | 19 ++ ...de_partage_des_sources_d_illustrations.org | 32 ++ ..._evaluer_la_ligne_politique_d_un_media.org | 54 ++++ ...og_867_16-septembre-2006-anniv-19-ans.html | 274 ---------------- ...23_tkblog_875_by-the-wall-intersubkey.html | 236 -------------- ...20160726085509_tkblog_3_pitanime-2013.html | 271 ---------------- .../converted/20211211215731-krita.html | 4 +- testing.py | 15 + website_config.py | 61 ++++ 59 files changed, 1537 insertions(+), 1665 deletions(-) delete mode 100644 WIP/website_config.py create mode 100644 gemini-capsules/tykayn_blog/a-propos.gmi create mode 100644 gemini-capsules/tykayn_blog/accueil.gmi create mode 100644 gemini-capsules/tykayn_blog/blogroll.gmi create mode 100644 gemini-capsules/tykayn_blog/contact.gmi create mode 100644 gemini-capsules/tykayn_blog/footer-articles.gmi create mode 100644 gemini-capsules/tykayn_blog/index.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20060925100118_tkblog_861_dotclear-s-parti.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20100420192842_tkblog_456_salut-patrick-xkcd-style.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20211211215731-krita.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241111235943-sketches_de_toulouse.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112000047-sketches_18.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112000229-illus_mono_couleurs.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112000537-kinktober_2023.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112000653-calin_yuri_ah.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112000757-conseils_de_pratique_du_dessin.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112000852-essais_en_cabine.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112001001-la_fougue_dans_les_rideaux.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112001055-dossier_de_partage_des_sources_d_illustrations.gmi create mode 100644 gemini-capsules/tykayn_blog/lang_fr/20241112001152-comment_evaluer_la_ligne_politique_d_un_media.gmi create mode 100644 gemini-capsules/tykayn_blog/projets.gmi delete mode 100644 html-websites/tykayn_blog/2006/tkblog_867_16-septembre-2006-anniv-19-ans/index.html delete mode 100644 html-websites/tykayn_blog/2006/tkblog_875_by-the-wall-intersubkey/index.html rename sources/tykayn_blog/lang_fr/converted/20060925100118_tkblog_861_dotclear-s-parti.html => html-websites/tykayn_blog/2024/20241111235943-sketches_de_toulouse/index.html (75%) rename html-websites/tykayn_blog/{2006/tkblog_861_dotclear-s-parti/index.html => a-propos.html} (63%) create mode 100644 html-websites/tykayn_blog/accueil.html rename sources/tykayn_blog/lang_fr/converted/20100420192842_tkblog_456_salut-patrick-xkcd-style.html => html-websites/tykayn_blog/blogroll.html (81%) create mode 100644 html-websites/tykayn_blog/contact.html create mode 100644 html-websites/tykayn_blog/footer-articles.html rename sources/tykayn_blog/lang_fr/converted/20200718145450_tkblog_997_.html => html-websites/tykayn_blog/projets.html (51%) create mode 100644 sources/tykayn_blog/lang_fr/20241111235943-sketches_de_toulouse.org create mode 100644 sources/tykayn_blog/lang_fr/20241112000047-sketches_18.org create mode 100644 sources/tykayn_blog/lang_fr/20241112000229-illus_mono_couleurs.org create mode 100644 sources/tykayn_blog/lang_fr/20241112000537-kinktober_2023.org create mode 100644 sources/tykayn_blog/lang_fr/20241112000653-calin_yuri_ah.org create mode 100644 sources/tykayn_blog/lang_fr/20241112000757-conseils_de_pratique_du_dessin.org create mode 100644 sources/tykayn_blog/lang_fr/20241112000852-essais_en_cabine.org create mode 100644 sources/tykayn_blog/lang_fr/20241112001001-la_fougue_dans_les_rideaux.org create mode 100644 sources/tykayn_blog/lang_fr/20241112001055-dossier_de_partage_des_sources_d_illustrations.org create mode 100644 sources/tykayn_blog/lang_fr/20241112001152-comment_evaluer_la_ligne_politique_d_un_media.org delete mode 100644 sources/tykayn_blog/lang_fr/converted/20060925104233_tkblog_867_16-septembre-2006-anniv-19-ans.html delete mode 100644 sources/tykayn_blog/lang_fr/converted/20060925105123_tkblog_875_by-the-wall-intersubkey.html delete mode 100644 sources/tykayn_blog/lang_fr/converted/20160726085509_tkblog_3_pitanime-2013.html create mode 100644 testing.py create mode 100644 website_config.py diff --git a/WIP/website_config.py b/WIP/website_config.py deleted file mode 100644 index 649af60a..00000000 --- a/WIP/website_config.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/python3 -# configuration pour générer les sites web de plusieurs dossiers -configs_sites = { - "cipherbliss_blog": { - "dossier_source":"cipherbliss_blog", - "titre_site":"CipherBliss", - "nom_domaine_html": "www.cipherbliss.com", - "nom_domaine_gemini": "source.cipherbliss.com", - "auteur": "Baptiste Lemoine", - "description": "Petite Entreprise de développement web et logiciels libres depuis 2014" - }, -} diff --git a/build_indexes.py b/build_indexes.py index b44b9949..dcf78378 100755 --- a/build_indexes.py +++ b/build_indexes.py @@ -5,6 +5,8 @@ import datetime import shutil import re +from website_config import configs_sites + # from enrich_html import static_page_path # génère l'index gemini et html des articles rangés par langue diff --git a/enrich_html.py b/enrich_html.py index be8d4ac1..55bcd679 100755 --- a/enrich_html.py +++ b/enrich_html.py @@ -2,6 +2,7 @@ import os import argparse import re +from website_config import configs_sites 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.") @@ -12,13 +13,16 @@ args = parser.parse_args() # Style CSS minimaliste style_file = args.style - -blog_name = args.blog_name +blog_name = args.blog_name.replace('html-websites/','') source_blog = f"sources/{blog_name}" header_content_path = f"{source_blog}/templates/converted/header_page.html" footer_content_path = f"{source_blog}/templates/converted/footer_page.html" static_page_path = f"{source_blog}/templates/html/static.html" + +print('---------- blog name ', blog_name) +template_content = configs_sites[blog_name] + footer_content='' after_article='' # TODO add footer on every article @@ -27,33 +31,6 @@ after_article='' # TODO make these variables overrided by configuration of a source website # variables du template de page -BANNIERE_ENTETE='' -BLOG_TITLE='Cipher Bliss' -BLOG_SUBTITLE='Code, nouvelles technologies et entrepreneurariat par B. Lemoine' -TITLE='' -AUTHOR='' -PAGE_TITLE='' -LOCALE='fr_FR' -DESCRIPTION='' -NDD='https://www.cipherbliss.com' -EMAIL='contact@cipherbliss.com' -SITE_ICON='https://www.cipherbliss.com/wp-content/uploads/2016/12/rond.png' -SITE_ICON_TYPE='image/png' -NAVIGATION=""" - -""" -BANNIERE_ENTETE='https://www.cipherbliss.com/wp-content/uploads/2016/11/bg.jpg' -BANNIERE_ENTETE_ALT='bannière du site' -ARTICLE='' -FOOTER='' - - def extract_body_content(html_content): pattern = r']*?>(.*?)' @@ -119,40 +96,40 @@ def enrich_one_file(file, root_path): - - - - - - + + + + + + - {TITLE} - - - - + {template_content['TITLE']} + + + + - - - + + +