diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-07-14 11:35:17 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-07-14 11:35:17 -0700 |
commit | 680d7b515f2467a74c508c3c26281eead9af6e7a (patch) | |
tree | 586f66597f6245a65b055a17974a4eb14a7b5470 /src/Text/Pandoc/App | |
parent | ed0548d8983d0e2a3bd50602d166837b13e31a85 (diff) | |
download | pandoc-680d7b515f2467a74c508c3c26281eead9af6e7a.tar.gz |
Logging: Added UnknownExtensions constructor to LogMessage.
[API change]
Issue this warning when we're falling back to markdown or
html because we don't recognize the extension of the input or
output files.
Diffstat (limited to 'src/Text/Pandoc/App')
-rw-r--r-- | src/Text/Pandoc/App/OutputSettings.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs index a9034d6f2..31bd64c4c 100644 --- a/src/Text/Pandoc/App/OutputSettings.hs +++ b/src/Text/Pandoc/App/OutputSettings.hs @@ -70,9 +70,15 @@ optToOutputSettings opts = do if pdfOutput then liftIO $ pdfWriterAndProg (optWriter opts) (optPdfEngine opts) else case optWriter opts of - Nothing -> - return (fromMaybe "html" $ formatFromFilePaths [outputFile], - Nothing) + Nothing + | outputFile == "-" -> return ("html", Nothing) + | otherwise -> + case formatFromFilePaths [outputFile] of + Nothing -> do + report $ UnknownExtensions + [takeExtension outputFile] "html" + return ("html", Nothing) + Just f -> return (f, Nothing) Just f -> return (f, Nothing) let format = if ".lua" `isSuffixOf` writerName |