aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-01-03 10:16:07 -0800
committerJohn MacFarlane <[email protected]>2022-01-03 10:16:07 -0800
commit75c5218d4ffcd7aabbb8bc62d5e1b4d12332b8aa (patch)
tree6554afd1ec742376faaa60c6f6c52fab0694c40c
parent811eee7cad840a65dbdcd72649b4007a9e8e46e2 (diff)
Don't read sources until in/out format are verified.
Partially addresses #7797.
-rw-r--r--src/Text/Pandoc/App.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 59fd43bac..3ddc4c761 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -116,8 +116,6 @@ convertWithOpts opts = do
setInputFiles (fromMaybe ["-"] (optInputFiles opts))
setOutputFile (optOutputFile opts)
- inputs <- readSources sources
-
-- assign reader and writer based on options and filenames
readerName <- case optFrom opts of
Just f -> return f
@@ -282,6 +280,9 @@ convertWithOpts opts = do
(optCitationAbbreviations opts) $ mempty
let filterEnv = Environment readerOpts writerOptions
+
+ inputs <- readSources sources
+
doc <- (case reader of
TextReader r
| readerNameBase == "json" ->