mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-06-20 09:04:42 +02:00
up style and template
This commit is contained in:
parent
07cee6a65d
commit
f40c4c45f9
24 changed files with 194 additions and 189 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/bin/python3
|
||||
import os
|
||||
import argparse
|
||||
|
||||
import re
|
||||
|
||||
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.")
|
||||
|
@ -37,6 +37,22 @@ BANNIERE_ENTETE_ALT='bannière du site'
|
|||
ARTICLE=''
|
||||
FOOTER=''
|
||||
|
||||
def remove_properties_section(text):
|
||||
pattern = r"<h1 id=\"article\">Article</h1>.+?</ul>"
|
||||
replacement = ""
|
||||
return re.sub(pattern, replacement, text, flags=re.DOTALL)
|
||||
|
||||
def remove_article_head_properties_orgmode(text):
|
||||
pattern = r":PROPERTIES:.+?:END:"
|
||||
replacement = ""
|
||||
return re.sub(pattern, replacement, text, flags=re.DOTALL)
|
||||
|
||||
def remove_hint_html(text):
|
||||
pattern = r"<p>ceci<sub>estduhtml</sub></p>"
|
||||
replacement = ""
|
||||
return re.sub(pattern, replacement, text, flags=re.DOTALL)
|
||||
|
||||
|
||||
|
||||
def enrich_one_file(file, root_path):
|
||||
|
||||
|
@ -56,6 +72,10 @@ def enrich_one_file(file, root_path):
|
|||
with open(os.path.join(root_path, file), "r") as f:
|
||||
html_content = f.read()
|
||||
|
||||
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:
|
||||
print(' ----------- include css inline in each html page')
|
||||
with open(os.path.join(root_path, file), "r") as f:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue