Created
January 9, 2024 18:59
-
-
Save AdamGagorik/ea5a7b93ef0aebbab5c31878d8da3c67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
INP=main.tex | |
OUT=main.docx | |
REF=reference.docx | |
if [[ $# -ge 1 ]]; then | |
INP="${1%.*}.tex" | |
OUT="${1%.*}.docx" | |
fi | |
if [[ ! -f ${REF} ]]; then | |
echo "Creating reference template (${REF})" | |
pandoc --print-default-data-file="${REF}" > "${REF}" | |
echo "Please rerun the command to create the final docx" && exit 0 | |
fi | |
if [[ ! -f ${INP} ]]; then | |
echo "Input file (${INP}) does not exist!" && exit 1 | |
fi | |
echo "Compiling document (${INP}) to word file (${OUT})" | |
pandoc --reference-doc="${REF}" -o "${OUT}" "${INP}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment