From 5acd0c9c338491696656362baddced3e42d3185e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 2 Apr 2018 22:44:53 +0100 Subject: [PATCH] Add support for metadata file --- build.sh | 11 ++++++++++- test/metadata.yaml | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/metadata.yaml diff --git a/build.sh b/build.sh index 6785f98..f79e05e 100755 --- a/build.sh +++ b/build.sh @@ -4,9 +4,18 @@ 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 -PANDOC_ARGS="$INPUT_FILE --template $SCRIPTPATH/main.tex -o $OUTPUT_FILE" +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 diff --git a/test/metadata.yaml b/test/metadata.yaml new file mode 100644 index 0000000..c12aff0 --- /dev/null +++ b/test/metadata.yaml @@ -0,0 +1,3 @@ +--- +foo: bar +...