aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANUAL.txt5
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs13
2 files changed, 10 insertions, 8 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index de6c48446..92c439f32 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -356,11 +356,12 @@ header when requesting a document from a URL:
`slidy`, `slideous`, or `s5` directory
placed in this directory will override pandoc's normal defaults.
-`-d` *FILE*, `--defaults=`*FILE*
+`-d` *FILE*[,*FILE*,...], `--defaults=`*FILE*[,*FILE*,...]
: Specify a set of default option settings. *FILE* is a YAML
file whose fields correspond to command-line option
- settings. All options for document conversion, including input
+ settings. (Multiple files may be specified, separated by
+ commas.) All options for document conversion, including input
and output files, can be set using a defaults file. The file will
be searched for first in the working directory, and then in
the `defaults` subdirectory of the user data directory
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 019ec9220..cf5fb51dc 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -64,6 +64,7 @@ import Data.Text (Text)
import Text.DocTemplates (ToContext(toVal), Context(..))
import qualified Text.Pandoc.UTF8 as UTF8
import qualified Data.YAML as Y
+import Data.List.Split (splitWhen)
parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
parseOptions options' defaults = do
@@ -161,11 +162,8 @@ options =
, Option "d" ["defaults"]
(ReqArg
- (\arg opt -> do
- let fp' = if null (takeExtension arg)
- then addExtension arg "yaml"
- else arg
- foldM applyDefaults opt [fp']
+ (\arg opt ->
+ foldM applyDefaults opt (splitWhen (==',') arg)
)
"FILE")
""
@@ -982,7 +980,10 @@ splitField s =
-- | Apply defaults from --defaults file.
applyDefaults :: Opt -> FilePath -> IO Opt
-applyDefaults opt fp = runIOorExplode $ do
+applyDefaults opt filepath = runIOorExplode $ do
+ let fp = if null (takeExtension filepath)
+ then addExtension filepath "yaml"
+ else filepath
setVerbosity $ optVerbosity opt
dataDirs <- liftIO defaultUserDataDirs
let fps = case optDataDir opt of