mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-06-20 09:04:42 +02:00
refacto
This commit is contained in:
parent
9267636687
commit
086287fad3
48 changed files with 536 additions and 1681 deletions
27
utils.py
Normal file
27
utils.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/python3
|
||||
import re
|
||||
|
||||
# this path should be customized
|
||||
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)
|
||||
if match:
|
||||
if match.group(1) != 'Article':
|
||||
return match.group(1)
|
||||
else:
|
||||
pattern = r'^\*\* (.+)$'
|
||||
match = re.search(pattern, content, re.MULTILINE)
|
||||
if match:
|
||||
return match.group(1)
|
||||
return None
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue