aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App/OutputSettings.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/App/OutputSettings.hs')
-rw-r--r--src/Text/Pandoc/App/OutputSettings.hs12
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