diff --git a/generate.sh b/generate.sh index 1388c1f..2d3c502 100755 --- a/generate.sh +++ b/generate.sh @@ -30,6 +30,7 @@ target="www" defaultLang="fr" header="header.html" footer="footer.html" +org=0 testDocker=0 ################################################################################ @@ -53,6 +54,7 @@ Les options suivantes seront codées dans un futur proche : fr par défaut -n génère la langue dans le nom du fichier et non dans le chemin (example.org/fr/index.html -> example.org/index.fr.html) + -o génère les fichiers org EOF } @@ -67,6 +69,9 @@ fi while [ -n "$1" ] do case $1 in + "-o") # génération des fichiers org + org=1 + ;; "-c") # on nettoie les fichiers # TODO si on précise un dossier, nettoyer ce dossier echo "Nettoyage de $target" @@ -92,7 +97,7 @@ do done ############################################################################### -# Génère un fichier header temporaire propre à une langue +# Génère un fichier header propre à une langue # # $1 : le chemin vers le fichier header.link ############################################################################### @@ -106,16 +111,26 @@ function generate_header { FS = ":" code = 0 } - /^%endlinks%$/ { code = 0 } - code == 1 && ! /^#/ { - gsub(/ $/, "", $1); gsub(/^ /, "", $2) - print " <a href=\""$1"\">"$2"</a>" - } - /^%links%$/ { code = 1 } - ' $1 >> $tmpHeader + { + if ($0 ~ /^%links%$/) { + code = 1 + next + } else if ($0 ~ /^%endlinks%$/) { + code = 0 + } + + if (code && $1 !~ /^#/) { + gsub(/ $/, "", $1); gsub(/^ /, "", $2) + print " <a href=\""$1"\">"$2"</a>" + } + }' $1 >> $tmpHeader echo -e " </div>\n" >> $tmpHeader } + + + + if [ $testDocker -eq 1 ] then docker build . --tag site && echo -e \ @@ -230,17 +245,29 @@ cp -t $target -r $annexes echo "Generate default index page..." cp $target/$defaultLang/index.html $target - -# on récupère les numéros des lignes à modifier -for c in $(awk 'BEGIN { code = 0 } - /\/div/ { code = 0 } - code == 1 { print NR } - /id="header-links"/ { code = 1 } - ' $target/index.html) +for c in $(awk 'BEGIN { + FS = "\n"; + code = 0 + } + { + if ($0 ~ /id="header-links"/) { + code = 1 + next + } else if ($0 ~ /\/div/) { + code = 0 + } if (code) { + print NR + } + }' $target/index.html) do sed -i -e "$c s/href=\"/href=\"$defaultLang\//" $target/index.html done -#echo "Link Links (lul)" -#ln -s $pathLinks $target +echo "Link Links (lul)" +ln -s $pathLinks $target +if [ $org -eq 1 ] +then + echo "Generate org files..." + #emacs -u $USER --script publish.el +fi diff --git a/lang/en/projects.html b/lang/en/projects.html index 5341117..a019ae5 100644 --- a/lang/en/projects.html +++ b/lang/en/projects.html @@ -86,14 +86,6 @@ rel="stylesheet" href="/css/projets.css" <td><a href="https://ilearned.eu/comprendre-licences.html">Comprendre les différentes licences</a></td> <td><a href="https://ilearned.eu/about.html#licence">CC-BY-NC-SA</a></td> </tr> - <tr> - <td><a href="https://github.com/sueszli/notionBackup">notionBackup</a></td> - <td>export Notion pages into HTML pages</td> - <td>Python</td> - <td>sueszli</td> - <td><a href="https://github.com/sueszli/notionBackup/commit/efbb9a442d4da36684ede8b262d770ccdf006f05">efbb9a4</a></td> - <td><a href="https://github.com/sueszli/notionBackup/blob/main/LICENSE">GNU AGPL v3</a></td> - </tr> <tr> <td><a href="https://github.com/orgalan/">Orgalan</a></td> <td>Organization with some tools to manage LAN, plane mirror</td> @@ -126,14 +118,6 @@ rel="stylesheet" href="/css/projets.css" <td><a href="https://github.com/pentoo/pentoo-overlay/commit/eeb881ae4d115adb80b1b80e9d5b1d9488b3cd74">liblnk</a></td> <td>GNU GPL v2</td> </tr> - <tr> - <td><a href="https://github.com/pwndbg/pwndbg.github.io">pwndbg.github.io</a></td> - <td>Web site of pwndbg</td> - <td>Astro</td> - <td>pwndbg community</td> - <td><a href="https://github.com/pwndbg/pwndbg.github.io/commit/4a34553e014b7e9f7bcc9959c89bd5f77f9d20d5">4a34553</a></td> - <td>None</td> - </tr> <tr> <td><a href="https://github.com/mantisbt-plugins/source-integration">source-integration</a></td> <td>MantisBT plugin to add commits coming from Git servers.</td> diff --git a/lang/en/where.html b/lang/en/where.html index 8247bee..0a3fc63 100644 --- a/lang/en/where.html +++ b/lang/en/where.html @@ -38,7 +38,6 @@ <p>cf. previous section</p> <hr /> <h3>Mail</h3> - <p>If possible, write a <a href="https://useplaintext.email/">plain text</a> email.</p> <ul> <li>rick [at] gnous [dot] eu</li> </ul> diff --git a/lang/fr/ou.html b/lang/fr/ou.html index a9301ba..8a0853c 100644 --- a/lang/fr/ou.html +++ b/lang/fr/ou.html @@ -38,7 +38,6 @@ <p>cf. section précédente</p> <hr /> <h3>Mail</h3> - <p>Si possible, au format <a href="https://useplaintext.email/">texte simple</a> (lien en anglais).</p> <ul> <li>rick [at] gnous [dot] eu</li> </ul> diff --git a/lang/fr/projets.html b/lang/fr/projets.html index 3abe30a..d94f6ce 100644 --- a/lang/fr/projets.html +++ b/lang/fr/projets.html @@ -86,14 +86,6 @@ rel="stylesheet" href="/css/projets.css" <td><a href="https://ilearned.eu/comprendre-licences.html">Comprendre les différentes licences</a></td> <td><a href="https://ilearned.eu/about.html#licence">CC-BY-NC-SA</a></td> </tr> - <tr> - <td><a href="https://github.com/sueszli/notionBackup">notionBackup</a></td> - <td>exporter les pages Notion en pages HTML</td> - <td>Python</td> - <td>sueszli</td> - <td><a href="https://github.com/sueszli/notionBackup/commit/efbb9a442d4da36684ede8b262d770ccdf006f05">efbb9a4</a></td> - <td><a href="https://github.com/sueszli/notionBackup/blob/main/LICENSE">GNU AGPL v3</a></td> - </tr> <tr> <td><a href="https://github.com/orgalan/">Orgalan</a></td> <td>Organisation contenant du code pour gérer des LANs, miroir de plane</td> @@ -126,14 +118,6 @@ rel="stylesheet" href="/css/projets.css" <td><a href="https://github.com/pentoo/pentoo-overlay/commit/eeb881ae4d115adb80b1b80e9d5b1d9488b3cd74">liblnk</a></td> <td>GNU GPL v2</td> </tr> - <tr> - <td><a href="https://github.com/pwndbg/pwndbg.github.io">pwndbg.github.io</a></td> - <td>Site web de pwndbg</td> - <td>Astro</td> - <td>Communauté pwndbg</td> - <td><a href="https://github.com/pwndbg/pwndbg.github.io/commit/4a34553e014b7e9f7bcc9959c89bd5f77f9d20d5">4a34553</a></td> - <td>Aucune</td> - </tr> <tr> <td><a href="https://github.com/mantisbt-plugins/source-integration">source-integration</a></td> <td>Plugin MantisBT pour ajouter les commits venant de serveurs Git</td>