From 680d7b515f2467a74c508c3c26281eead9af6e7a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 14 Jul 2019 11:35:17 -0700 Subject: 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. --- src/Text/Pandoc/App/OutputSettings.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc/App') 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 -- cgit v1.2.3