# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/plain-html
#

preprocessing:
  stage: build
  allow_failure: false
  image: 
    name: alpine:latest
  script:
    - apk add --no-cache --upgrade bash
    - RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
    # preprocess .MD files
    - $RESEARCH_ROOT/bin/preprocIndexMd.sh
    - $RESEARCH_ROOT/bin/preprocMd.sh
  artifacts:
    paths:
      - build

pandoc: 
  stage: test
  dependencies: [preprocessing]
  image:      
    name: pandoc/latex:latest
    entrypoint: ["/bin/sh", "-c"]
  script:
    # build research topics
    - pandoc --standalone build/topic-template.md -o build/topic-template.html  --mathjax
    # build index
    - pandoc --standalone build/index.md -o build/index.html --mathjax
    # build static working group pages
    - pandoc --standalone ./build/aa.md -o ./build/aa.html --mathjax
    - pandoc --standalone ./build/dm.md -o ./build/dm.html --mathjax
    - pandoc --standalone ./build/cm.md -o ./build/cm.html --mathjax
    - pandoc --standalone ./build/nm.md -o ./build/nm.html --mathjax
    - pandoc --standalone ./build/st.md -o ./build/st.html --mathjax
    # build static staff pages (generated by create-staff-yml.sh)
    - pandoc --standalone ./build/ataraz.md -o ./build/ataraz.html --mathjax
    - pandoc --standalone ./build/cseifert.md -o ./build/cseifert.html --mathjax
    - pandoc --standalone ./build/dclemens.md -o ./build/dclemens.html --mathjax
    - pandoc --standalone ./build/dgallaun.md -o ./build/dgallaun.html --mathjax
    - pandoc --standalone ./build/druprecht.md -o ./build/druprecht.html --mathjax
    - pandoc --standalone ./build/fboesch.md -o ./build/fboesch.html --mathjax
    - pandoc --standalone ./build/fbuenger.md -o ./build/fbuenger.html --mathjax
    - pandoc --standalone ./build/fgabel.md -o ./build/fgabel.html --mathjax
    - pandoc --standalone ./build/fhamann.md -o ./build/fhamann.html --mathjax
    - pandoc --standalone ./build/hruan.md -o ./build/hruan.html --mathjax
    - pandoc --standalone ./build/hvoss.md -o ./build/hvoss.html --mathjax
    - pandoc --standalone ./build/jangel.md -o ./build/jangel.html --mathjax
    - pandoc --standalone ./build/jdornemann.md -o ./build/jdornemann.html --mathjax
    - pandoc --standalone ./build/jfregin.md -o ./build/jfregin.html --mathjax
    - pandoc --standalone ./build/jgrams.md -o ./build/jgrams.html --mathjax
    - pandoc --standalone ./build/jgrossmann.md -o ./build/jgrossmann.html --mathjax
    - pandoc --standalone ./build/jmeichsner.md -o ./build/jmeichsner.html --mathjax
    - pandoc --standalone ./build/jpmzemke.md -o ./build/jpmzemke.html --mathjax
    - pandoc --standalone ./build/jurizarna.md -o ./build/jurizarna.html --mathjax
    - pandoc --standalone ./build/kalbrecht.md -o ./build/kalbrecht.html --mathjax
    - pandoc --standalone ./build/kklioba.md -o ./build/kklioba.html --mathjax
    - pandoc --standalone ./build/kkruse.md -o ./build/kkruse.html --mathjax
    - pandoc --standalone ./build/mjanssen.md -o ./build/mjanssen.html --mathjax
    - pandoc --standalone ./build/mlindner.md -o ./build/mlindner.html --mathjax
    - pandoc --standalone ./build/mschulte.md -o ./build/mschulte.html --mathjax
    - pandoc --standalone ./build/mwolkner.md -o ./build/mwolkner.html --mathjax
    - pandoc --standalone ./build/pbaasch.md -o ./build/pbaasch.html --mathjax
    - pandoc --standalone ./build/pgupta.md -o ./build/pgupta.html --mathjax
    - pandoc --standalone ./build/rbeddig.md -o ./build/rbeddig.html --mathjax
    - pandoc --standalone ./build/rukena.md -o ./build/rukena.html --mathjax
    - pandoc --standalone ./build/sgoetschel.md -o ./build/sgoetschel.html --mathjax
    - pandoc --standalone ./build/sleborne.md -o ./build/sleborne.html --mathjax
    - pandoc --standalone ./build/sotten.md -o ./build/sotten.html --mathjax
    - pandoc --standalone ./build/tsaathoff.md -o ./build/tsaathoff.html --mathjax
    - pandoc --standalone ./build/vgriem.md -o ./build/vgriem.html --mathjax
    - pandoc --standalone ./build/vtrapp.md -o ./build/vtrapp.html --mathjax
    - pandoc --standalone ./build/wleinen.md -o ./build/wleinen.html --mathjax
    - pandoc --standalone ./build/wmackens.md -o ./build/wmackens.html --mathjax
    - pandoc --standalone ./build/ymogge.md -o ./build/ymogge.html --mathjax
  artifacts:
    paths:
      - build/*.html

pages:
  stage: deploy
  script:
    - mkdir .public
    - cp -r build/*.html .public
    - cp -r img .public/.
    - mv .public public
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
