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.
This commit is contained in:
John MacFarlane 2019-11-14 21:46:35 -08:00
parent 81fae63a54
commit bfa6c0b57d
2 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -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" ->