24 lines
507 B
Bash
Executable file
24 lines
507 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
SCRIPT=`realpath $0`
|
|
SCRIPTPATH=`dirname $SCRIPT`
|
|
|
|
INPUT_FILE=`realpath $1`
|
|
INPUT_DIR=`dirname $INPUT_FILE`
|
|
METADATA_FILE="$INPUT_DIR/metadata.yaml"
|
|
OUTPUT_FILE=output.pdf
|
|
|
|
INPUT_FILES="$INPUT_FILE"
|
|
|
|
if [ -f "$METADATA_FILE" ]
|
|
then
|
|
INPUT_FILES="$INPUT_FILES $METADATA_FILE"
|
|
fi
|
|
|
|
PANDOC_ARGS="$INPUT_FILES --template $SCRIPTPATH/main.tex -o $OUTPUT_FILE"
|
|
|
|
echo "Building document..."
|
|
pandoc $PANDOC_ARGS
|
|
|
|
echo "Running second pass..."
|
|
pandoc $PANDOC_ARGS --lua-filter=second-pass.lua
|