configure (1013B)
- #!/bin/sh
- # SPDX-FileCopyrightText: 2023 Haelwenn (lanodan) Monnier <contact+blog@hacktivis.me>
- # SPDX-License-Identifier: MIT
- templates_en="./templates/head.xml ./templates/en/nav.xsl ./templates/en/footer.shtml"
- templates_fr="./templates/head.xml ./templates/fr/nav.xsl ./templates/fr/footer.shtml"
- cat >|config.ninja <<-EOF
- # Generated by: $0 $@
- rule gen_config
- command = $0 "$@"
- generator = 1
- build config.ninja: gen_config configure | ./articles
- build entry.xsl: xinclude entry.xsl.in | ${templates_en}
- build entrée.xsl: xinclude entrée.xsl.in | ${templates_fr}
- build bookmarks.xsl: xinclude bookmarks.xsl.in | ${templates_en}
- build nginx_autoindex.xsl: xinclude nginx_autoindex.xsl.in | ${templates_en}
- EOF
- for file in articles/*.xml
- do
- i="${file//$/\$\$}" # '$' → '$$'
- i="${i// /$ }" # ' ' → '$ '
- if grep -q -F 'xml:lang="fr"' "$file"; then
- echo "build ${i//.xml/.html}: article_fr entrée.xsl ${i}"
- else
- echo "build ${i//.xml/.html}: article entry.xsl ${i}"
- fi
- done >>config.ninja