mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-06-20 09:04:42 +02:00
up style
This commit is contained in:
parent
086287fad3
commit
1d224cb8e4
1995 changed files with 66244 additions and 8957 deletions
28
utils.py
28
utils.py
|
@ -6,12 +6,14 @@ org_roam_dir: str = '/home/tykayn/Nextcloud/textes/orgmode/org-roam/'
|
|||
|
||||
pattern_roam_id_search = r':ID:(?:\s+)?([a-zA-Z0-9-]+)'
|
||||
|
||||
|
||||
def get_id_of_roam_note_content(content):
|
||||
match = re.search(pattern_roam_id_search, content)
|
||||
if match:
|
||||
return match.group(1)
|
||||
return None
|
||||
|
||||
|
||||
def find_first_level1_title(content):
|
||||
pattern = r'^\* (.+)$'
|
||||
match = re.search(pattern, content, re.MULTILINE)
|
||||
|
@ -25,3 +27,29 @@ def find_first_level1_title(content):
|
|||
return match.group(1)
|
||||
return None
|
||||
|
||||
|
||||
def extract_body_content(html_content):
|
||||
pattern = r'<body[^>]*?>(.*?)</body>'
|
||||
match = re.search(pattern, html_content, re.DOTALL)
|
||||
if match:
|
||||
return match.group(1)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue