defaultLang="fr"
header="header.html"
footer="footer.html"
-org=0
testDocker=0
################################################################################
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
}
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"
done
###############################################################################
-# Génère un fichier header propre à une langue
+# Génère un fichier header temporaire propre à une langue
#
# $1 : le chemin vers le fichier header.link
###############################################################################
FS = ":"
code = 0
}
- {
- 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
+ /^%endlinks%$/ { code = 0 }
+ code == 1 && ! /^#/ {
+ gsub(/ $/, "", $1); gsub(/^ /, "", $2)
+ print " <a href=\""$1"\">"$2"</a>"
+ }
+ /^%links%$/ { code = 1 }
+ ' $1 >> $tmpHeader
echo -e " </div>\n" >> $tmpHeader
}
-
-
-
-
if [ $testDocker -eq 1 ]
then
docker build . --tag site && echo -e \
echo "Generate default index page..."
cp $target/$defaultLang/index.html $target
-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)
+
+# 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)
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