This commit is contained in:
Tykayn 2024-11-19 13:49:39 +01:00 committed by tykayn
parent 895996cf6b
commit 8daf1e23e4
2055 changed files with 119377 additions and 31850 deletions

View file

@ -66,7 +66,7 @@ def generer_index(dossier_source, fichier_index):
article_name = trouver_nom_article(file_path_org, args.source, 'org')
basename_file = os.path.basename(file_path_org)
date_str, annee, slug = find_year_and_slug(basename_file)
date_str, annee, slug = find_year_and_slug_on_filename(basename_file)
article_relative_url=f"/{annee}/{slug}/"
if not article_name:
@ -74,15 +74,16 @@ def generer_index(dossier_source, fichier_index):
if global_config["slug_with_year"]:
new_folder_path_this_article = os.path.join(dossier_parent, f"html-websites/{args.source}/{article_relative_url}/")
new_folder_path_this_article = new_folder_path_this_article.replace('//','/')
print("article_relative_url",article_relative_url)
# déplacer le fichier html dans le dossier slug,
# et le renommer en index.html ensuite pour ne pas modifier l'index du blog
contenu_index_html += f"<br/><a href={article_relative_url}>{article_name}</a>"
os.makedirs(os.path.dirname(new_folder_path_this_article), exist_ok=True)
contenu_index_html += f"<br/><a href={article_relative_url}>{annee} - {article_name}</a>"
mylog(" -------- créer le dossier de l article ", new_folder_path_this_article)
shutil.copy(chemin_fichier_this_article_html, new_folder_path_this_article + 'index.html')
os.makedirs(os.path.dirname(new_folder_path_this_article), exist_ok=True)
mylog('chemin_fichier_this_article_html',chemin_fichier_this_article_html)
shutil.copy2(chemin_fichier_this_article_html, new_folder_path_this_article + 'index.html')
else:
contenu_index_html += f"<br/><a href=/{lang_folder}/{link_html}>{link_html}</a>"