From bfa6c0b57df299e7d574e65b9b04f65456dfdf28 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 14 Nov 2019 21:46:35 -0800
Subject: [PATCH] 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.
---
 MANUAL.txt                 | 2 +-
 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" ->