{after_article}
#!/bin/python3 import argparse import os from utils import * 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.") parser.add_argument("--style", default="templates/style_general.css", help="Le chemin vers le fichier de style CSS.") args = parser.parse_args() # Style CSS minimaliste style_file = args.style blog_name = args.blog_name.replace('html-websites/', '') html_pages = 'html-websites/'+blog_name 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" enable_header=True mylog('---------- blog name ', blog_name) template_content = configs_sites[blog_name] after_article = '' inline_the_css = False # inline_the_css=True def enrich_one_file(html_content: str, partials: dict = {"header_page": "", "footer_content": ""}) -> str: """ Enrich a single HTML file by removing certain parts, extracting the body content, and incorporating a template. The function also includes options to inline the CSS and customize the HTML content based on the provided partials. Parameters: html_content (str): The original HTML content to be enriched. partials (dict, optional): A dictionary containing partial HTML content for the header and footer. The default values are empty strings. Returns: str: The enriched HTML content. """ # remove some parts html_content = extract_body_content(html_content) html_content = remove_properties_section(html_content) html_content = remove_article_head_properties_orgmode(html_content) html_content = remove_hint_html(html_content) if inline_the_css is True: mylog(' ----------- enrich_html: include css inline in each html page') with open(os.path.join(root_path, file), "r") as f: css_content = f.read() css_content = "" template_content["CSS_INLINE_CONTENT"] = css_content template_content["PAGE_SLUG"] = find_slug_in_file_basename(file) # remplir le template html_content = f"""