pandoc-make: there we go (revert PANDOC_DEFAULT_ARGS)

This commit is contained in:
PowerUser64 2022-04-14 16:25:19 -07:00
parent c231a2ab5c
commit 70d5d0a503

View file

@ -17,8 +17,9 @@ usage() {
1) To put a file in pandoc arguments without having it be compiled to its own document, put a './' or '../' at the start of the path to it 1) To put a file in pandoc arguments without having it be compiled to its own document, put a './' or '../' at the start of the path to it
- You can have as many arg/file combinations you want - You can have as many arg/file combinations you want
- The argument array is cleared between input files - The argument array is cleared between input files
2) You can set default arguments in the array PANDOC_DEFAULT_ARGS and export them for this script to use
EOF EOF
# TODO:
# 2) You can set default arguments in the array PANDOC_DEFAULT_ARGS and export them for this script to use
} }
# Help menu (yes, I forget how to use my own programs sometimes) # Help menu (yes, I forget how to use my own programs sometimes)
@ -39,7 +40,7 @@ SKIP_FIRST=true # don't process the first argument, it is the output format
for FILE in "$@";do for FILE in "$@";do
$SKIP_FIRST && SKIP_FIRST=false && continue $SKIP_FIRST && SKIP_FIRST=false && continue
PANDOC_ARGS="${PANDOC_DEFAULT_ARGS[*]:-"$PANDOC_ARGS"}" # PANDOC_ARGS="${PANDOC_DEFAULT_ARGS[*]:-"$PANDOC_ARGS"}"
if [[ -f "$FILE" ]] && { [[ "${FILE:0:2}" != "./" ]] || [[ "${FILE:0:3}" != "../" ]]; }; then if [[ -f "$FILE" ]] && { [[ "${FILE:0:2}" != "./" ]] || [[ "${FILE:0:3}" != "../" ]]; }; then
pandoc -s "$FILE" "${PANDOC_ARGS[@]}" -o "${FILE%.*}.${OUTPUT_FORMAT##.}" pandoc -s "$FILE" "${PANDOC_ARGS[@]}" -o "${FILE%.*}.${OUTPUT_FORMAT##.}"
PANDOC_ARGS=() PANDOC_ARGS=()