image: brospars/pandoc-gitlab-ci:latest
pages:
  stage: deploy
  script:
  - pandoc --version
  - pandoc --help
  # - pandoc --list-input-formats    # Broken as pandoc dates from 2013 on this image! :(
  - for file in $(find -name "*.md"); do
        pandoc -s -f gfm -t html -o ${file%.*}.html $file && echo "Exported ${file%.*}.html" && echo "
${file%.*}.html" >> index.html || echo "ERROR $file";
        bin/pandoc_fixer.pl ${file} > ${file}.new;
        mv ${file}.new ${file};
    done
  # The next part is broken because pandoc is way too old on this image :(
  # - for file in $(find -name "*.org"); do 
  #     pandoc -s -f org -t html -o ${file%.*}.html $file && echo "Exported ${file%.*}.html" || echo "ERROR $file";
  #   done
  - shopt -s extglob
  - mv !(public) public
  artifacts:
    paths:
    - public
  only:
  - master