#!/bin/bash

echo "Finding pandoc"
set +e
which pandoc 2> /dev/null > /dev/null
if [[ $? == 0 ]]; then
    echo "Updating README.md from README.rst"
    pandoc --from=rst --to=markdown --output=README.md.in --wrap=none README.rst
    cat << EOF > README.md
<!--   'README.md' is automatically generated by 'build.sh' using 'pandoc'.
                         Edit 'README.rst' instead !                         -->
EOF
    cat README.md.in >> README.md
    rm -f README.md.in
fi
