mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-06-20 09:04:42 +02:00
up
This commit is contained in:
parent
672f61f2bb
commit
6d77de4696
15 changed files with 203 additions and 506 deletions
25
utils.py
25
utils.py
|
@ -64,27 +64,38 @@ def trouver_nom_article(fichier_org, blog_name, format="html"):
|
|||
|
||||
return nom_article.replace(blog_name + '_', '').replace('_', ' ')
|
||||
|
||||
def find_org_roam_id(content):
|
||||
match = re.search(pattern_roam_id_search, content)
|
||||
if match:
|
||||
return match.group(1)
|
||||
return None
|
||||
|
||||
def get_blog_template_conf(blogname) -> dict:
|
||||
"""
|
||||
Retourne la configuration du blog spécifié.
|
||||
|
||||
:param blogname: Nom du blog (str).
|
||||
:return: Configuration du blog (dict).
|
||||
"""
|
||||
if blogname not in configs_sites:
|
||||
return default_config
|
||||
else:
|
||||
return configs_sites[blogname]
|
||||
|
||||
def find_year_and_slug_on_filename(fichier):
|
||||
fichier = fichier.replace('..', '.')
|
||||
# mylog(f" ------------ find_year_and_slug in {fichier} -------------")
|
||||
fichier = fichier.replace('..', '.')
|
||||
slug = ''
|
||||
annee = datetime.now().year
|
||||
date_str = f'{annee}-00-00'
|
||||
date = f'{annee}-00-00'
|
||||
boom = fichier.split('__')
|
||||
# print(boom)
|
||||
|
||||
if boom :
|
||||
date_str = boom[0]
|
||||
annee = date_str[:4]
|
||||
slug = boom[1].replace('.org', '')
|
||||
|
||||
# Convertir la date en objet datetime
|
||||
if "-" in date_str:
|
||||
slug = enlever_premier_tiret_ou_underscore(slug)
|
||||
|
||||
# mylog(f" find_year_and_slug : chemin: {annee}/{slug}/")
|
||||
return [date_str, annee, slug]
|
||||
return [date_str, annee, fichier.replace(' ', '-').replace('.org', '')]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue