pandoc-latex-template/examples/build-examples.sh

38 lines
810 B
Bash
Raw Normal View History

#!/bin/bash
set -e
echo "##"
echo "# building examples"
echo "##"
echo ""
containsElement () {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
# these examples are skipped because they don't run on travis (for now)
skippedExamples=("language-chinese" "language-japanese")
# loop all files in the current folder
for f in *; do
# run only for folders
if [ -d "$f" ]; then
if containsElement "$f" "${skippedExamples[@]}"; then
2021-02-02 22:25:19 +00:00
echo "skipping '$f'"
echo ""
else
2021-02-02 22:25:19 +00:00
echo "building '$f'"
cd "$f"
echo " - running pandoc build script"
bash "$PWD/build.sh"
echo " - generating preview"
pdftoppm -r 150 -png "document.pdf" > "preview.png"
echo ""
cd ".."
fi
fi
done