2017-05-18 20:41:05 +00:00
|
|
|
#!/bin/bash
|
2017-05-31 18:57:36 +00:00
|
|
|
set -e
|
2017-05-18 20:41:05 +00:00
|
|
|
|
2019-02-17 19:29:28 +00:00
|
|
|
echo "##"
|
2021-02-02 22:07:32 +00:00
|
|
|
echo "# building examples"
|
2019-02-17 19:29:28 +00:00
|
|
|
echo "##"
|
|
|
|
echo ""
|
|
|
|
|
2021-02-02 22:07:32 +00:00
|
|
|
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)
|
2021-02-02 22:10:32 +00:00
|
|
|
skippedExamples=("language-chinese" "language-japanese")
|
2021-02-02 22:07:32 +00:00
|
|
|
|
|
|
|
# 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'"
|
2021-02-02 22:07:32 +00:00
|
|
|
echo ""
|
|
|
|
else
|
2021-02-02 22:25:19 +00:00
|
|
|
echo "building '$f'"
|
2021-02-02 22:07:32 +00:00
|
|
|
cd "$f"
|
|
|
|
echo " - running pandoc build script"
|
2021-02-02 22:18:49 +00:00
|
|
|
bash "$PWD/build.sh"
|
2021-02-02 22:07:32 +00:00
|
|
|
echo " - generating preview"
|
|
|
|
pdftoppm -r 150 -png "document.pdf" > "preview.png"
|
|
|
|
echo ""
|
|
|
|
cd ".."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|