arrête d'utiliser des bouts de categorie

Je me dit qu'il faudrait trouver une meilleur solution. Est-ce que c'est
un travail éditorial, et donc c'est bon de le faire la main ? Ça me
permettrais de raconter des histoires parallèles...

Ou bien avoir un outil plus complet, et dans ce cas, pourquoi ne pas
prendre un moteur de blog plus classique ?
This commit is contained in:
Yannick Francois
2020-03-29 00:29:25 +01:00
parent decab6db7b
commit 73bc637553
8 changed files with 44 additions and 83 deletions
+21 -23
View File
@@ -3,31 +3,29 @@ import os
keywords = "keywords.md"
with open(keywords) as f:
content = f.readlines()
content = [y for x in content for y in x.strip().split(':') ]
lines = f.readlines()
for line in lines:
content = [y for y in line.strip().split(':') ]
keyword = content[0]
directory = "content/" + content[0]
filename = content[1].replace("content", "")
htmlfilename = filename.replace(".md", ".html")
article = content[2]
keyword = content[0]
directory = "content/" + content[0]
filename = content[1].replace("content", "")
htmlfilename = filename.replace(".md", ".html")
article = content[2]
if os.path.exists(directory + ".md"):
os.remove(directory + ".md")
if os.path.exists(directory + ".html"):
os.remove(directory + ".html")
if os.path.exists(directory + "/index.md"):
os.remove(directory + "/index.md")
if os.path.exists(directory + "/index.html"):
os.remove(directory + "/index.html")
if os.path.exists(directory):
os.rmdir(directory)
fileindex=directory + ".md"
if not os.path.exists(directory):
os.makedirs(directory)
with open(fileindex, 'a') as keywordFile:
if keywordFile.tell() == 0:
keywordFile.write('---\ntitle: ' + keyword.capitalize() + "\n---\n")
print("tel 0 ?")
print(keyword + " article : " + article + " html : " + htmlfilename)
keywordFile.write("- [" + article + "](" + htmlfilename + ")\n")
fileindex=directory + "/index.md"
with open(fileindex, 'a') as f:
if f.tell() == 0:
f.write('---\ntitle: ' + keyword.capitalize() + "\n---\n")
f.write("- [" + article + "](" + htmlfilename + ")\n")
fileindexhtml=directory + "/index.html"
os.system('pandoc --template=lib/template.html -c lib/pandoc.css ' + fileindex + ' -o ' + fileindexhtml)
fileindexhtml=directory + ".html"
os.system('pandoc --template=lib/template.html -c lib/pandoc.css ' + fileindex + ' -o ' + fileindexhtml)