Skip to content
Permalink
Browse files

Use Athena to build PDF, if Docker installed

Merges #210
Closes #170

More information about Athena is available at
https://github.com/arachnys/athenapdf

Based on meta-review commit:
greenelab/meta-review@cffcfea
  • Loading branch information...
dhimmel committed Apr 24, 2019
1 parent 0399e5f commit 0e29315c1c732c36d5e9bc9a637185b3a7f7d431
Showing with 23 additions and 2 deletions.
  1. +2 −0 .travis.yml
  2. +21 −2 build/build.sh
@@ -1,6 +1,8 @@
dist: trusty
sudo: false
language: generic
services:
- docker
branches:
only:
- master
@@ -50,9 +50,12 @@ pandoc --verbose \
--output=output/manuscript.html \
$INPUT_PATH

# Return null if docker command is missing, otherwise return path to docker
DOCKER_EXISTS=`command -v docker`

# Create PDF output (unless BUILD_PDF environment variable equals "false")
if [ "$BUILD_PDF" != "false" ]; then
echo "Exporting PDF manuscript"
if [ "$BUILD_PDF" != "false" ] && [ -z "$DOCKER_EXISTS" ]; then
echo "Exporting PDF manuscript using WeasyPrint"
if [ -L images ]; then rm images; fi # if images is a symlink, remove it
ln -s content/images
pandoc \
@@ -73,6 +76,22 @@ if [ "$BUILD_PDF" != "false" ]; then
rm images
fi

# Create PDF output (unless BUILD_PDF environment variable equals "false")
if [ "$BUILD_PDF" != "false" ] && [ -n "$DOCKER_EXISTS" ]; then
echo "Exporting PDF manuscript using Docker + Athena"
if [ -d output/images ]; then rm -rf output/images; fi # if images is a directory, remove it
cp -R -L content/images output/
docker run \
--rm \
--volume `pwd`/output:/converted/ \
--security-opt seccomp:unconfined \
arachnysdocker/athenapdf:2.16.0 \
athenapdf \
--delay=2000 \
manuscript.html manuscript.pdf
rm -rf output/images
fi

# Create DOCX output (if BUILD_DOCX environment variable equals "true")
if [ "$BUILD_DOCX" = "true" ]; then
echo "Exporting Word Docx manuscript"

0 comments on commit 0e29315

Please sign in to comment.
You can’t perform that action at this time.