corrige la génération de page catégorie

This commit is contained in:
Yannick Francois
2020-03-15 01:05:39 +01:00
parent 33d604b0f6
commit 02a4bdc640
11 changed files with 78 additions and 60 deletions
+33
View File
@@ -0,0 +1,33 @@
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(':') ]
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 + "/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)
if not os.path.exists(directory):
os.makedirs(directory)
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)
-2
View File
@@ -1,2 +0,0 @@
- [accueil](/)
+1 -4
View File
@@ -1,10 +1,8 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta name="generator" content="Hugo 0.22.1" />
<meta charset="utf-8">
<title>Yannick François - Elsif.fr</title>
<meta name="DC.title" content="elsif.fr, site de Yannick François aka yaf (ou ya_f)."/>
<meta name="description" content="Le site de Yannick François. Développeur Senior, Responsable Produit, Pédagogue. Je travail chez Scopyleft"/>
<meta name="keywords" content="code, développement, programmation, apprentissage, apprendre, lean, agile, logiciel, tdd, objet, refactoring, libre, creative commons, linux, unix"/>
@@ -22,8 +20,7 @@
</head>
<body>
<article>
<h1 id="boîte-à-idée">Boîte à idée</h1>
<h1>Boîte à idée</h1>
<p><em>ou bien liste énorme de truc que jaimerais bien faire un jour</em></p>
<ul>
<li>Acheter des bocaux pour faire de la fermentation de legumes</li>
+3 -1
View File
@@ -1,4 +1,6 @@
# Boîte à idée
---
title: Boîte à idée
---
_ou bien liste énorme de truc que j'aimerais bien faire un jour_
+1 -1
View File
@@ -5,7 +5,7 @@
<subtitle>les dernières mise à jour du site</subtitle>
<link href="http://elsif.fr/" />
<id>tag:elsif.fr</id>
<updated>Sun, 08 Mar 2020 01:05:24 +0100</updated>
<updated>Sun, 15 Mar 2020 01:04:24 +0100</updated>
<entry xml:lang='fr'><title><a class="top header-title" href="../../index.html">Les pieds dans le code</a>
-2
View File
@@ -1,2 +0,0 @@
- [OpenBSD](/)
@@ -1,10 +1,8 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta name="generator" content="Hugo 0.22.1" />
<meta charset="utf-8">
<title>Yannick François - Elsif.fr</title>
<meta name="DC.title" content="elsif.fr, site de Yannick François aka yaf (ou ya_f)."/>
<meta name="description" content="Le site de Yannick François. Développeur Senior, Responsable Produit, Pédagogue. Je travail chez Scopyleft"/>
<meta name="keywords" content="code, développement, programmation, apprentissage, apprendre, lean, agile, logiciel, tdd, objet, refactoring, libre, creative commons, linux, unix"/>
@@ -1,10 +1,8 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta name="generator" content="Hugo 0.22.1" />
<meta charset="utf-8">
<title>Yannick François - Elsif.fr</title>
<meta name="DC.title" content="elsif.fr, site de Yannick François aka yaf (ou ya_f)."/>
<meta name="description" content="Le site de Yannick François. Développeur Senior, Responsable Produit, Pédagogue. Je travail chez Scopyleft"/>
<meta name="keywords" content="code, développement, programmation, apprentissage, apprendre, lean, agile, logiciel, tdd, objet, refactoring, libre, creative commons, linux, unix"/>
@@ -22,9 +20,9 @@
</head>
<body>
<article>
<h1>Ruby</h1>
<ul>
<li><a href="/">OpenBSD</a></li>
<li><a href="/posts/2009/2009-01-10-ruby-et-les-frameworks-web.html">Ruby et les frameworks web</a></li>
</ul>
</article>
<footer>
+4
View File
@@ -0,0 +1,4 @@
---
title: Ruby
---
- [Ruby et les frameworks web](/posts/2009/2009-01-10-ruby-et-les-frameworks-web.html)
-2
View File
@@ -1,10 +1,8 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta name="generator" content="Hugo 0.22.1" />
<meta charset="utf-8">
<title>Yannick François - Elsif.fr</title>
<meta name="DC.title" content="elsif.fr, site de Yannick François aka yaf (ou ya_f)."/>
<meta name="description" content="Le site de Yannick François. Développeur Senior, Responsable Produit, Pédagogue. Je travail chez Scopyleft"/>
<meta name="keywords" content="code, développement, programmation, apprentissage, apprendre, lean, agile, logiciel, tdd, objet, refactoring, libre, creative commons, linux, unix"/>
+12 -20
View File
@@ -10,7 +10,10 @@ KEYWORDS=keywords.md
cat "" > $KEYWORDS
echo "## Generate HTML files for each markdown files"
for mdfile in $MARKDOWN_FILES; do
echo "-------------- current file $mdfile"
htmlfile="${mdfile%%.*}.html"
if [ ! -f "$htmlfile" ] || [ "$htmlfile" -ot "$mdfile" ]; then
echo "--> generate with pandoc '$htmlfile' from '$mdfile'"
@@ -19,28 +22,17 @@ for mdfile in $MARKDOWN_FILES; do
pandoc --template=lib/extract-keywords.md "$mdfile" >> $KEYWORDS
done
for line in $(cat $KEYWORDS); do
directory=content/$(echo $line | awk -F":" '{print $1}')
echo $directory
fichier=/$(echo $line | awk -F":" '{print $2}' | awk -F"content|index.md" '{print $1}')
echo $fichier
titre=$(echo $line | awk -F":" '{print $3}')
echo $titre
if [ ! -d $directory ]; then
mkdir -p $directory
fi
if [ ! -f $directory/index.md ]; then
touch $directory/index.md
else
echo "" > $directory/index.md
echo "## END"
echo "## Build keywords pages"
python build_theme_index.py
if [ ! -f "$htmlfile" ] || [ "$htmlfile" -ot "$mdfile" ]; then
echo "--> generate with pandoc '$htmlfile' from '$mdfile'"
pandoc --template=lib/template.html -c lib/pandoc.css "$mdfile" -o "$htmlfile"
fi
echo "## END"
echo "- [$titre]($fichier)" >> $directory/index.md
pandoc --template=lib/template.html -c lib/pandoc.css "$directory/index.md" -o "$directory/index.html"
done
echo "Build atom"
echo "## Build atom"
LAST_CHANGES=$(git log --pretty="format:" --name-only | grep "content/posts/20*" | grep ".html" | uniq | tac | head -10)
echo "liste des 10 derniers fichiers qui ont changés : $LAST_CHANGES"