From adad3c70b6d68563f2dad5136705fcaa33d719ea Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 6 Nov 2019 09:06:49 -0800 Subject: Allow singular input-file in defaults file. Closes #5877. --- MANUAL.txt | 1 + src/Text/Pandoc/App/Opt.hs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/MANUAL.txt b/MANUAL.txt index fedb147b1..2e37d62a0 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1436,6 +1436,7 @@ output-file: input-files: - preface.md - content.md +# or you may use input-file: with a single value template: letter standalone: true diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index a93b2a212..6db397147 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -194,6 +194,10 @@ doOpt (k',v) = do parseYAML v >>= \x -> return (\o -> o{ optOutputFile = unpack <$> x }) "input-files" -> parseYAML v >>= \x -> return (\o -> o{ optInputFiles = map unpack x }) + "input-file" -> -- allow either a list or a single value + (parseYAML v >>= \x -> return (\o -> o{ optInputFiles = map unpack x })) + <|> + (parseYAML v >>= \x -> return (\o -> o{ optInputFiles = [unpack x] })) "number-sections" -> parseYAML v >>= \x -> return (\o -> o{ optNumberSections = x }) "number-offset" -> -- cgit v1.2.3