diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-11-14 21:46:35 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-11-14 21:46:35 -0800 |
commit | bfa6c0b57df299e7d574e65b9b04f65456dfdf28 (patch) | |
tree | 71ff7e837d5b4078cde54f29a1b9f9ec853838ce | |
parent | 81fae63a5429266fd04c25a8da8fa442eee8c788 (diff) | |
download | pandoc-bfa6c0b57df299e7d574e65b9b04f65456dfdf28.tar.gz |
Default files: Allow leaving input-files blank again.
Leaving it blank yields a Nothing value (interpreted as stdin).
Providing an empty list is intepreted as no input.
This resolves one part of #5888.
-rw-r--r-- | MANUAL.txt | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/App/Opt.hs | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index ef737c452..4c03cc6d7 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -1433,7 +1433,7 @@ to: html5 # leave blank for output to stdout: output-file: -# leave blank for input from stdin: +# leave blank for input from stdin, use [] for no input: input-files: - preface.md - content.md diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index ed167fff2..09f018233 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -202,15 +202,16 @@ doOpt (k',v) = do "input-files" -> parseYAML v >>= \x -> return (\o -> o{ optInputFiles = optInputFiles o <> - Just (map unpack x) }) + (map unpack <$> x) }) "input-file" -> -- allow either a list or a single value (parseYAML v >>= \x -> return (\o -> o{ optInputFiles = optInputFiles o <> - Just (map unpack x) })) + (map unpack <$> x) })) <|> (parseYAML v >>= \x -> return (\o -> o{ optInputFiles = optInputFiles o <> - Just [unpack x] })) + ((\z -> [unpack z]) <$> x) + })) "number-sections" -> parseYAML v >>= \x -> return (\o -> o{ optNumberSections = x }) "number-offset" -> |