diff --git a/atom_generate.py b/atom_generate.py index 7194c69d..5f7364a8 100755 --- a/atom_generate.py +++ b/atom_generate.py @@ -90,3 +90,5 @@ with open(f"index_{args.blog_dir}.xml", "w", encoding="utf-8") as f: f.write(f' {entry["published"]}\n') f.write(' \n') f.write('') + +os.rename(f"index_{args.blog_dir}.xml", f"html-websites/{args.blog_dir}/feed/index.xml") \ No newline at end of file diff --git a/build_indexes.py b/build_indexes.py index e437f3e5..fdf96b47 100755 --- a/build_indexes.py +++ b/build_indexes.py @@ -66,14 +66,17 @@ 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) - article_relative_url = find_slug_in_file_basename(basename_file) + date_str, annee, slug = find_year_and_slug(basename_file) + article_relative_url=f"/{annee}/{slug}/" if not article_name: - article_name = article_relative_url.replace('-', ' ') + article_name = basename_file.replace('-', ' ') if global_config["slug_with_year"]: new_folder_path_this_article = os.path.join(dossier_parent, f"html-websites/{args.source}/{article_relative_url}/") + + 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"
{article_name}" @@ -121,7 +124,7 @@ def generer_index(dossier_source, fichier_index): print(' ') with open(chemin_fichier_index_html, 'w', encoding='utf-8') as file: print('contenu_index_html', contenu_index_html) - contenu_index_html = enrich_one_file(contenu_index_html) + # contenu_index_html = enrich_one_file(contenu_index_html) file.write(contenu_index_html) print(f" ------------ build_indexes: Fichier d'index '{chemin_fichier_index_html}' généré avec succès.") diff --git a/converters.sh b/converters.sh index 55db0934..3a5bdad6 100755 --- a/converters.sh +++ b/converters.sh @@ -208,12 +208,14 @@ for website_name in "${blogs_folders[@]}"; do python3 build_indexes.py $website_name # créer les pages de tags + mkdir -p "html-websites/$website_name/tags" + mkdir -p "html-websites/$website_name/tag" python3 gather_tags_in_json.py $website_name # déplacer les fichiers générés en html dans le dossier statique mv sources/$website_name/converted/*.html html-websites/$website_name/ - python3 enrich_html.py html-websites/$website_name --style $style_file + python3 enrich_html.py $website_name --style $style_file # copier le style dans le dossier html cp $style_file html-websites/$website_name/style.css @@ -222,8 +224,9 @@ for website_name in "${blogs_folders[@]}"; do # traiter les réductions d'images dans l'inbox python3 pictures_resize.py + + # régénérer le flux Atom du blog mkdir -p "html-websites/$website_name/feed" python3 atom_generate.py $website_name - mv "index_$website_name.xml" "html-websites/$website_name/feed/index.xml" done diff --git a/enrich_html.py b/enrich_html.py index 56393cd8..48113264 100755 --- a/enrich_html.py +++ b/enrich_html.py @@ -90,7 +90,7 @@ def enrich_one_file(html_content: str, partials: dict = {"header_page": "", "foo