git.iko.soy/typeable/pandoc
on master help sign in
Revert "ALlow multiple comma-separated files for `--defaults`."

This reverts commit e96f3fd813b3f8b73c3457ff6e9177e2a4a74164.

commit02c579ff3c8256f2e3529f76a6f665a85fec084d authorJohn MacFarlane <jgm@berkeley.edu> dateFri 1 Nov 2019, 21:48 (7 years ago) parente96f3fd
2 files changed+8−10
MANUAL.txt+2−3 src/Text/Pandoc/App/CommandLineOptions.hs+6−7
MANUAL.txt+2−3
@@ -356,12 +356,11 @@ header when requesting a document from a URL:
356356 `slidy`, `slideous`, or `s5` directory
357357 placed in this directory will override pandoc's normal defaults.
358358
359−`-d` *FILE*[,*FILE*,...], `--defaults=`*FILE*[,*FILE*,...]
359+`-d` *FILE*, `--defaults=`*FILE*
360360
361361: Specify a set of default option settings. *FILE* is a YAML
362362 file whose fields correspond to command-line option
363− settings. (Multiple files may be specified, separated by
364− commas.) All options for document conversion, including input
363+ settings. All options for document conversion, including input
365364 and output files, can be set using a defaults file. The file will
366365 be searched for first in the working directory, and then in
367366 the `defaults` subdirectory of the user data directory
src/Text/Pandoc/App/CommandLineOptions.hs+6−7
@@ -64,7 +64,6 @@ import Data.Text (Text)
6464import Text.DocTemplates (ToContext(toVal), Context(..))
6565import qualified Text.Pandoc.UTF8 as UTF8
6666import qualified Data.YAML as Y
67−import Data.List.Split (splitWhen)
6867
6968parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
7069parseOptions options' defaults = do
@@ -162,8 +161,11 @@ options =
162161
163162 , Option "d" ["defaults"]
164163 (ReqArg
165− (\arg opt ->
166− foldM applyDefaults opt (splitWhen (==',') arg)
164+ (\arg opt -> do
165+ let fp' = if null (takeExtension arg)
166+ then addExtension arg "yaml"
167+ else arg
168+ foldM applyDefaults opt [fp']
167169 )
168170 "FILE")
169171 ""
@@ -980,10 +982,7 @@ splitField s =
980982
981983-- | Apply defaults from --defaults file.
982984applyDefaults :: Opt -> FilePath -> IO Opt
983−applyDefaults opt filepath = runIOorExplode $ do
984− let fp = if null (takeExtension filepath)
985− then addExtension filepath "yaml"
986− else filepath
985+applyDefaults opt fp = runIOorExplode $ do
987986 setVerbosity $ optVerbosity opt
988987 dataDirs <- liftIO defaultUserDataDirs
989988 let fps = case optDataDir opt of