up tkblog source

This commit is contained in:
Tykayn 2024-11-15 01:45:11 +01:00 committed by tykayn
parent 1e7a81acd2
commit ffea486a3f
2715 changed files with 127267 additions and 78041 deletions

View file

@ -31,13 +31,24 @@ inline_the_css = False
# inline_the_css=True
def enrich_one_file(html_content, partials={"header_page": "", "footer_content": ""}):
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)
html_content = extract_body_content(html_content)
if inline_the_css is True:
print(' ----------- enrich_html: include css inline in each html page')