logo

blog

My website can't be that messy, right? git clone https://anongit.hacktivis.me/git/blog.git/

configure (1013B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2023 Haelwenn (lanodan) Monnier <contact+blog@hacktivis.me>
  3. # SPDX-License-Identifier: MIT
  4. templates_en="./templates/head.xml ./templates/en/nav.xsl ./templates/en/footer.shtml"
  5. templates_fr="./templates/head.xml ./templates/fr/nav.xsl ./templates/fr/footer.shtml"
  6. cat >|config.ninja <<-EOF
  7. # Generated by: $0 $@
  8. rule gen_config
  9. command = $0 "$@"
  10. generator = 1
  11. build config.ninja: gen_config configure | ./articles
  12. build entry.xsl: xinclude entry.xsl.in | ${templates_en}
  13. build entrée.xsl: xinclude entrée.xsl.in | ${templates_fr}
  14. build bookmarks.xsl: xinclude bookmarks.xsl.in | ${templates_en}
  15. build nginx_autoindex.xsl: xinclude nginx_autoindex.xsl.in | ${templates_en}
  16. EOF
  17. for file in articles/*.xml
  18. do
  19. i="${file//$/\$\$}" # '$' → '$$'
  20. i="${i// /$ }" # ' ' → '$ '
  21. if grep -q -F 'xml:lang="fr"' "$file"; then
  22. echo "build ${i//.xml/.html}: article_fr entrée.xsl ${i}"
  23. else
  24. echo "build ${i//.xml/.html}: article entry.xsl ${i}"
  25. fi
  26. done >>config.ninja