From 47a81050dc892a04bd176e14422daacf9e41e84e Mon Sep 17 00:00:00 2001 From: Oxbian Date: Mon, 3 Apr 2023 12:01:26 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20RSS/Atom=20&=20de=20la=20g=C3=A9n?= =?UTF-8?q?=C3=A9ration=20du=20fichier=20index?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ readme.md | 6 ++++- tools/atom_post_template.xml | 23 ++++++++++++++++++ tools/atom_template.xml | 12 ++++++++++ tools/index_template.html | 43 +++++++++++++++++++++++++++++++++ tools/page-generator.py | 46 ++++++++++++++++++++++++++++++------ tools/page_template.html | 2 +- 7 files changed, 125 insertions(+), 9 deletions(-) create mode 100644 tools/atom_post_template.xml create mode 100644 tools/atom_template.xml create mode 100644 tools/index_template.html diff --git a/.gitignore b/.gitignore index 5dd81ed..7a38bf4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .venv archives articles/* +atom.xml +index.html \ No newline at end of file diff --git a/readme.md b/readme.md index 56c2116..4831d75 100644 --- a/readme.md +++ b/readme.md @@ -8,4 +8,8 @@ Le générateur en python permet de passé de fichier markdown à des fichier ht # TODO - Flux RSS -- Ajout automatique des pages générées dans la page principale \ No newline at end of file +- Ajout automatique des pages générées dans la page principale + +# Crédits + +Ce projet m'a été inspiré par le [générateur de blog](https://git.sr.ht/~lioploum/ploum.net) de [Ploum](https://ploum.net), merci à lui pour son travail remarquable. \ No newline at end of file diff --git a/tools/atom_post_template.xml b/tools/atom_post_template.xml new file mode 100644 index 0000000..52703f7 --- /dev/null +++ b/tools/atom_post_template.xml @@ -0,0 +1,23 @@ + + Oxbianhttps://blog.arka.rocks + $TITLE + + $URL + $DATE + $DATE + + <h1>$TITLE</h1> + $CONTENT + + + +

Articles sur les bonnes pratiques

+ + +

Autres articles

+ \ No newline at end of file diff --git a/tools/atom_template.xml b/tools/atom_template.xml new file mode 100644 index 0000000..9fca838 --- /dev/null +++ b/tools/atom_template.xml @@ -0,0 +1,12 @@ + + + blog.arka.rocks + Blog d'Oxbian + $DATE + + https://blog.arka.rocks + +$CONTENT + diff --git a/tools/index_template.html b/tools/index_template.html new file mode 100644 index 0000000..680e43a --- /dev/null +++ b/tools/index_template.html @@ -0,0 +1,43 @@ + + + + + + + + + + + Blog d'Oxbian + + + + + +
+ +
+
+
+

Bienvenue sur mon blog

+

Sur ce blog vous retrouverez des articles liées à l'informatique, la programmation, le réseau, la sécurité, le libre, etc. + De plus j'y partage aussi des articles sur les bonnes pratiques dans divers domaines, comme la vie privée, le sport..

+ + $CONTENT +
+
+
+ + + \ No newline at end of file diff --git a/tools/page-generator.py b/tools/page-generator.py index e5747db..bde61a0 100644 --- a/tools/page-generator.py +++ b/tools/page-generator.py @@ -2,10 +2,12 @@ import os articles_path = 'articles/' generate_path = 'archives/' +atom_content = "" +index_content = "

Articles

')) + output.close() -def updateIndex(data): -""" if __name__=="__main__": if not os.path.exists('../' + generate_path): os.mkdir('../' + generate_path) - else: + else: # Régénation du blog for file in os.listdir('../' + generate_path): os.remove('../' + generate_path + file) + os.remove('../atom.xml') + os.remove('../index.html') + for file in os.listdir('../' + articles_path): print("Génération en cours du fichier: " + file) - md2html(file) \ No newline at end of file + md2html(file) + print("Génération du fichier RSS / Atom") + generateAtom() + print("Génération de l'index") + updateIndex() \ No newline at end of file diff --git a/tools/page_template.html b/tools/page_template.html index 3dda284..7c6bf0d 100644 --- a/tools/page_template.html +++ b/tools/page_template.html @@ -10,7 +10,7 @@ $TITLE - +