move to several websites
@ -46,3 +46,9 @@ https://forge.chapril.org/tykayn/org-report-stats
|
||||
Dotclear, Wordpress, Hugo, Pélican
|
||||
Pandoc, PandocGmi
|
||||
https://github.com/njamescouk/pandocGmi/tree/master
|
||||
|
||||
# Roadmap
|
||||
- TODO gestion multi site et multi langue
|
||||
- TODO config par site web de son nom de domaine
|
||||
- TODO réécriture des liens internes
|
||||
- TODO gestion des langues dans la source et la destination
|
@ -1,59 +0,0 @@
|
||||
import os
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
# Chemin du dossier source
|
||||
source_dir = "source"
|
||||
|
||||
# Expression régulière pour extraire la date du contenu de l'article
|
||||
date_regex = re.compile(r"\b(\d{4}-\d{2}-\d{2})\b")
|
||||
|
||||
# Liste des fichiers org-mode trouvés
|
||||
org_files = []
|
||||
|
||||
# Parcourt le dossier source à la recherche de fichiers org-mode
|
||||
for root, dirs, files in os.walk(source_dir):
|
||||
for file in files:
|
||||
if file.endswith(".org"):
|
||||
# Ouvre le fichier et recherche la première date dans le contenu de l'article
|
||||
with open(os.path.join(root, file), "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
match = date_regex.search(content)
|
||||
if match:
|
||||
date = datetime.strptime(match.group(1), "%Y-%m-%d")
|
||||
# Ajoute le fichier à la liste avec sa date correspondante
|
||||
org_files.append((date, os.path.join(root, file)))
|
||||
|
||||
# Tri des fichiers par ordre décroissant de date
|
||||
org_files.sort(reverse=True)
|
||||
|
||||
# Génération du flux Atom
|
||||
atom_feed = {"title": "Flux Atom des articles GMI", "link": "http://www.example.com/atom", "updated": org_files[0][0].strftime("%Y-%m-%dT%H:%M:%SZ"), "entries": []}
|
||||
for date, file in org_files:
|
||||
# Parse le fichier org-mode pour extraire le titre, la description et la date de publication
|
||||
with open(file, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
title = re.search(r"\*+ (.+)\n", content).group(1)
|
||||
description = re.search(r"\n+ (.+)\n", content, re.DOTALL).group(1)
|
||||
published = date.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
# Ajoute l'article au flux Atom
|
||||
atom_entry = {"title": title, "link": file, "summary": description, "published": published}
|
||||
atom_feed["entries"].append(atom_entry)
|
||||
if date > datetime.strptime(atom_feed["updated"], "%Y-%m-%dT%H:%M:%SZ"):
|
||||
atom_feed["updated"] = published
|
||||
|
||||
# Enregistrement du flux Atom dans un fichier
|
||||
with open("articles.atom", "w", encoding="utf-8") as f:
|
||||
f.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
f.write("<feed xmlns=\"http://www.w3.org/2005/Atom\">\n")
|
||||
f.write(f" <title>{atom_feed['title']}</title>\n")
|
||||
f.write(f" <link href=\"{atom_feed['link']}\"/>\n")
|
||||
f.write(f" <updated>{atom_feed['updated']}</updated>\n")
|
||||
for entry in atom_feed["entries"]:
|
||||
f.write(" <entry>\n")
|
||||
f.write(f" <title>{entry['title']}</title>\n")
|
||||
f.write(f" <link href=\"{entry['link']}\"/>\n")
|
||||
f.write(f" <summary>{entry['summary']}</summary>\n")
|
||||
f.write(f" <published>{entry['published']}</published>\n")
|
||||
f.write(" </entry>\n")
|
||||
f.write("</feed>\n")
|
@ -1,32 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# conversion des pages d'articles depuis le dossier source en orgmode
|
||||
cd source
|
||||
mkdir converted
|
||||
for i in *.org ; do echo "$i" && pandoc -f org -t markdown -s $i -o $i.md ; done
|
||||
for i in *.org ; do echo "$i" && pandoc -f org -t html -s $i -o $i.html ; done
|
||||
for i in *.org ; do echo "$i" && pandoc --template ../template_gemini.lua -f org -t ../gmi.lua -s $i -o $i.gmi ; cat '../website_pages/footer-articles.md.gmi' >> $i.gmi ; done
|
||||
mkdir -p converted
|
||||
|
||||
# liste des dossiers à convertir
|
||||
blogs_folders=("dragonfeu")
|
||||
source_file_extension="org"
|
||||
|
||||
# Définition de la fonction generate_website
|
||||
generate_website() {
|
||||
echo " Génération du site $1..."
|
||||
|
||||
mkdir gemini-capsules/$website_name
|
||||
mkdir html-websites/$website_name
|
||||
|
||||
mv source/converted/*.gmi gemini-capsules/$website_name
|
||||
mv source/converted/*.html gemini-capsules/$website_name
|
||||
|
||||
# Ajoutez ici le code pour générer le site Web
|
||||
echo "Le site $1 a été généré avec succès."
|
||||
|
||||
for i in *.$source_file_extension ; do echo "$i" && pandoc -f $source_file_extension -t markdown -s $i -o $i.md ; done
|
||||
for i in *.$source_file_extension ; do echo "$i" && pandoc -f $source_file_extension -t html -s $i -o $i.html ; done
|
||||
for i in *.$source_file_extension ; do echo "$i" && pandoc --template ../template_gemini.lua -f $source_file_extension -t ../gmi.lua -s $i -o $i.gmi ; cat '../website_pages/footer-articles.md.gmi' >> $i.gmi ; done
|
||||
mv *.md converted
|
||||
mv *.html converted
|
||||
mv *.gmi converted
|
||||
cd ..
|
||||
|
||||
#mv *.org ../org
|
||||
|
||||
# conversion des pages d'articles en markwon si vous utilisez une source d'articles en markdown, perso c'est orgmode
|
||||
#cd md
|
||||
#for i in *.md ; do echo "$i" && pandoc -f markdown -t org -s $i -o $i.org ; done
|
||||
#mv *.org ../org
|
||||
#cd ..
|
||||
|
||||
# conversion des pages statiques
|
||||
cd website_pages
|
||||
for i in *.md ; do echo "$i" && pandoc --template ../template_gemini.lua -f markdown -t ../gmi.lua -s $i -o $i.gmi ; done
|
||||
for i in *.org ; do echo "$i" && pandoc --template ../template_gemini.lua -f org -t ../gmi.lua -s $i -o $i.gmi ; done
|
||||
# mv *.gmi ../
|
||||
mv *.gmi ../source/converted
|
||||
cd ..
|
||||
|
||||
# création de l'index:
|
||||
# prendre les fichiers markdown du dossier md/ , et créer un index des fichiers situés dedans, rangés par nom de fichier décroissant, sauver le tout dans un fichier index.gmi
|
||||
python3 build_index_gemini.py
|
||||
mv index.gmi source/converted
|
||||
|
||||
python3 enrich_html.py
|
||||
|
||||
}
|
||||
# regrouper les types de fichiers générés
|
||||
|
||||
cd source/converted
|
||||
|
||||
# Boucle à travers la liste des sites Web
|
||||
for website_name in "${sites[@]}"; do
|
||||
generate_website $website_name
|
||||
done
|
||||
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 159 KiB |
Before Width: | Height: | Size: 460 KiB After Width: | Height: | Size: 460 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 308 KiB After Width: | Height: | Size: 308 KiB |
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 174 KiB |
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 352 KiB After Width: | Height: | Size: 352 KiB |
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 176 KiB |
Before Width: | Height: | Size: 458 KiB After Width: | Height: | Size: 458 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 302 KiB After Width: | Height: | Size: 302 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |