move on index build and linking previous and next articles

This commit is contained in:
Tykayn 2025-02-19 16:24:20 +01:00 committed by tykayn
parent 7d221d970a
commit 16b93f380e
1711 changed files with 231792 additions and 838 deletions

View file

@ -4,6 +4,7 @@ import re
import shutil
from datetime import datetime
import unicodedata
import pypandoc
from website_config import *
@ -29,7 +30,7 @@ def mylog(*content):
def trouver_nom_article(fichier_org, blog_name, format="html"):
mylog('fichier_org, ', fichier_org)
# mylog('fichier_org, ', fichier_org)
with open(fichier_org, 'r') as file:
lignes = file.readlines()
@ -68,9 +69,9 @@ def find_year_and_slug_on_filename(fichier):
fichier = fichier.replace('..', '.')
# mylog(f" ------------ find_year_and_slug in {fichier} -------------")
slug = ''
annee = '2024'
date_str = '2024-00-00'
date = '2024-00-00'
annee = datetime.now().year
date_str = f'{annee}-00-00'
date = f'{annee}-00-00'
boom = fichier.split('__')
# print(boom)
@ -286,3 +287,17 @@ def find_slug_in_file_basename(file_basename) -> str:
return slug
return None
def convert_org_to_html(org_file, output_html_file):
"""
Convertit un fichier Org en HTML en utilisant pypandoc.
:param org_file: Chemin du fichier Org à convertir.
:param output_html_file: Chemin du fichier HTML de sortie.
"""
try:
pypandoc.convert_file(org_file, 'html', outputfile=output_html_file)
print(f"Conversion réussie : {org_file} -> {output_html_file}")
except Exception as e:
print(f"Erreur lors de la conversion de {org_file} : {e}")