diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-03-06 10:32:51 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-03-06 10:32:51 -0800 |
commit | 735a69de6b94e32ee9aceb44a893de4067f24354 (patch) | |
tree | 375e482e7922ce019fc1d3ed3750e7430b432712 /src/Text | |
parent | 26524246d0e3460338c9e90a171c554646abe4dc (diff) | |
download | pandoc-735a69de6b94e32ee9aceb44a893de4067f24354.tar.gz |
Allow `--resource-path` to accumulate.
Previously, if `--resource-path` were used multiple times, the last
resource path would replace the others.
With this change, each time `--resource-path` is used, it prepends
the specified path components to the existing resource path.
Similarly, when `resource-path` is specified in a defaults file,
the paths provided will be prepended to the existing resource
path.
This change also allows one to avoid using the OS-specific path
separator; instead, one can simply use `--resource-path`
a number of times with single paths. This form of command
will not have an OS-dependent behavior.
This change facilitates the use of multiple, small defaults
files: each can specify a directory containing its own
resources without clobbering the resource paths set by
the others.
Closes #6152.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 3 | ||||
-rw-r--r-- | src/Text/Pandoc/App/Opt.hs | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index ac92db0ae..b4483f756 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -288,7 +288,8 @@ options = , Option "" ["resource-path"] (ReqArg (\arg opt -> return opt { optResourcePath = - splitSearchPath arg }) + splitSearchPath arg ++ + optResourcePath opt }) "SEARCHPATH") "" -- "Paths to search for images and other resources" diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index d09a6afc0..e5aaec9c5 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -583,7 +583,8 @@ doOpt (k',v) = do optIncludeInHeader o <> [unpack x] })) "resource-path" -> parseYAML v >>= \x -> - return (\o -> o{ optResourcePath = map unpack x }) + return (\o -> o{ optResourcePath = map unpack x <> + optResourcePath o }) "request-headers" -> parseYAML v >>= \x -> return (\o -> o{ optRequestHeaders = x }) |