Skip to content

Commit

Permalink
paperdraft image: allow to keep intermediary tex file
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tarleb committed Jun 7, 2021
1 parent b63fc70 commit a159202
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion resources/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
#!/bin/sh
# Get options
keep_tex="0"
while getopts "k" "opt"; do
case "$opt" in
k)
keep_tex=1
;;
*)
echo $opt
;;
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 \
Expand Down

0 comments on commit a159202

Please sign in to comment.