pandoc-make: add PANDOC_DEFAULT_ARGS array
This commit is contained in:
parent
3af2360084
commit
19ca438748
1 changed files with 6 additions and 4 deletions
|
@ -14,9 +14,10 @@ usage() {
|
||||||
$0 .docx *.md # leading .'s are automatically removed from the output format
|
$0 .docx *.md # leading .'s are automatically removed from the output format
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
To put a file in pandoc arguments without having it be compiled to its own document, put a './' 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +39,8 @@ 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
|
||||||
if [[ -f "$FILE" ]] && [[ "${FILE:0:2}" != "./" ]]; then
|
PANDOC_ARGS="${PANDOC_DEFAULT_ARGS[*]:-"$PANDOC_ARGS"}"
|
||||||
|
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=()
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue