je déteste l'informatique

This commit is contained in:
OniriCorpe 2022-03-12 01:00:58 +01:00
parent 57c111cb6c
commit bcf2436030
3 changed files with 59 additions and 7 deletions

38
genlog.sh Normal file
View file

@ -0,0 +1,38 @@
#!/bin/bash
mkdir ${PWD}/temp/
find "${PWD}" -wholename "*.gmi" -type f | while read gmi_file
do
mkdir ${PWD}/temp/
echo "sed 1"
# récupérer la 1ère ligne du fichier .gmi et remplacer "# " par ""
title=$(sed -n "1{s/# //p}" $gmi_file)
echo "sed 2"
# dans le header.html, remplacer "<\-- TITLE -->" par le titre récupéré
# puis enregistrer le fichier ainsi modifié dans "temp/header.html"
sed "s/<\!-- TITLE -->/${title//\//\\/}/" ${PWD}/html/header.html > ${PWD}/temp/header.html
echo "sed 3"
date=$(date)
sed "s/GEN_DATE/$date/" ${PWD}/html/footer.html > ${PWD}/temp/footer.html
# conversion du .gmi en .html
gmnitohtml < $gmi_file > ${PWD}/temp/body.html
path=$(dirname $gmi_file)
cat ${PWD}/temp/header.html ${PWD}/temp/body.html ${PWD}/temp/footer.html > $path/index.html
rm -r ${PWD}/temp/*
echo "OK: $gmi_file"
done
rm -r ${PWD}/temp/
echo "Done."

View file

@ -1,8 +1,7 @@
<!-- Start footer.html -->
<div class="footer">
<p>Cette page est générée par <a href="https://labo.emelyne.eu/oniricorpe/genlog">genlog</a>, un scrip personnel qui
convertit un fichier texte Markdown en page Web et Gemini.</p>
<p>Cette page est consultable via <a href="https://gemini.circumlunar.space/">Gemini</a> à la meme adresse.</p>
<!-- Généré le : GEN_DATE -->
</div>
</div>

View file

@ -8,28 +8,43 @@
<!-- Start CSS -->
<style>
body {
margin: 2.5em auto 2.5em;
margin: 3em auto 3em;
background-color: #282828;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
color: #c0c0c0;
}
a {
color: #9700c2;
color: #9694ff;
}
a:visited {
color: #ebe12f;
}
a[href^="http"]::after {
content: "";
width: 11px;
height: 11px;
margin-left: 4px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");
background-size: contain;
display: inline-block;
}
.footer {
padding: 3rem 2rem 1rem 2rem;
padding: 2em 2em 0;
opacity: 0.8;
text-align: center;
}
</style>
<!-- End CSS -->
<title>Log | OniriCorpe</title>
<title>
<!-- TITLE -->
</title>
</head>