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): - - - - - - + + + + + + -{BLOG_SUBTITLE}
+{template_content['BLOG_SUBTITLE']}