build.sh (1528B)
1 #!/bin/sh 2 3 CATEGORIES="science society sport" 4 5 set -ex 6 7 mkdir -p gen out 8 9 # copy over static assets 10 cp -rv src/css/ src/js/ src/res/ public/ out/ 11 12 # template category pages 13 for category in $CATEGORIES; do 14 mkdir -p gen/$category out/$category 15 16 # template category article pages 17 for article in src/html/$category/*.html; do 18 name="$(basename -s .html $article)" 19 20 # template article snippet 21 ./tools/template.py \ 22 $article \ 23 gen/$category/$name.list.html \ 24 templates/listed-article.html \ 25 url="/$category/$name.html" 26 27 # template full article 28 ./tools/template.py \ 29 $article \ 30 gen/$category/$name.html \ 31 templates/article.html 32 33 ./tools/template.py \ 34 gen/$category/$name.html \ 35 out/$category/$name.html \ 36 templates/global.html 37 38 done 39 40 # generate category index page fragment 41 ./tools/index.py \ 42 gen/$category.index.html \ 43 templates/listitem.html \ 44 templates/index.html \ 45 "/$category" \ 46 gen/$category/*.list.html 47 done 48 49 # template main page 50 ./tools/index.py \ 51 gen/index.html \ 52 templates/listitem.html \ 53 templates/index.html \ 54 "/" \ 55 gen/*.index.html 56 57 # template static pages 58 ./tools/template.py gen/index.html out/index.html templates/global.html title="Lektura" 59 ./tools/template.py gen/science.index.html out/science.html templates/global.html title="Lektura: Science" 60 ./tools/template.py gen/society.index.html out/society.html templates/global.html title="Lektura: Society" 61 ./tools/template.py gen/sport.index.html out/sport.html templates/global.html title="Lektura: Sport"