From efae19726c4d0cba45a01c8add77ecf19c0d68cd Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Mon, 7 Jun 2021 09:23:22 +0200 Subject: [PATCH] paperdraft image: allow to keep intermediary tex file Passing the `-k` option when calling the image ensures that the intermediary LaTeX file, named `paper.tex`, is put next to the `paper.pdf` PDF file. See openjournals/joss#132 --- resources/docker-entrypoint.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/resources/docker-entrypoint.sh b/resources/docker-entrypoint.sh index 7ca16ba..5f88e40 100755 --- a/resources/docker-entrypoint.sh +++ b/resources/docker-entrypoint.sh @@ -1,13 +1,35 @@ #!/bin/sh +# Get options +keep_tex="0" +while getopts "k" "opt"; do + case "$opt" in + k) + keep_tex=1 + ;; + esac +done +shift "$(expr $OPTIND - 1)" + # The first argument must always be the path to the main paper # file. The working directory is switched to the folder that the # paper file is in. -input=$1 +input="$1" shift input_file="$(basename $input)" cd "$(dirname $input)" +## Create LaTeX file. +if [ "$keep_tex" -ge 1 ]; then + /usr/local/bin/pandoc \ + --defaults="$OPENJOURNALS_PATH"/docker-defaults.yaml \ + --defaults="$OPENJOURNALS_PATH"/"$JOURNAL"/defaults.yaml \ + --output=paper.tex \ + "$input_file" \ + "$@" +fi + +## Create full PDF /usr/local/bin/pandoc \ --defaults="$OPENJOURNALS_PATH"/docker-defaults.yaml \ --defaults="$OPENJOURNALS_PATH"/"$JOURNAL"/defaults.yaml \