aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-08-22 21:41:54 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-08-24 22:18:25 -0700
commitbf860df938782fc1862ce95d12b47c40e564373b (patch)
treec65e17bc6282ac447be1a7d63ff2fda7e94939a4
parent0efbfb33ada6166eb53c5effb1b80393647a1c40 (diff)
downloadpandoc-bf860df938782fc1862ce95d12b47c40e564373b.tar.gz
T.P.App.OutputSettings: Generalize some types...
so we can run this with any instance of PandocMonad and MonadIO, not just PandocIO.
-rw-r--r--src/Text/Pandoc/App.hs2
-rw-r--r--src/Text/Pandoc/App/OutputSettings.hs11
2 files changed, 6 insertions, 7 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 5696156ad..dd58b1b39 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -133,7 +133,7 @@ convertWithOpts opts = do
<> "` instead of `pandoc " <> inputFile <> " -o " <> outputFile <> "`."
_ -> return ()
- (reader :: Reader PandocIO, readerExts) <- getReader readerName
+ (reader, readerExts) <- getReader readerName
let convertTabs = tabFilter (if optPreserveTabs opts ||
readerNameBase == "t2t" ||
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
index 3864ab188..3f83f4b21 100644
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -45,16 +45,16 @@ readUtf8File :: PandocMonad m => FilePath -> m T.Text
readUtf8File = fmap UTF8.toText . readFileStrict
-- | Settings specifying how document output should be produced.
-data OutputSettings = OutputSettings
+data OutputSettings m = OutputSettings
{ outputFormat :: T.Text
- , outputWriter :: Writer PandocIO
+ , outputWriter :: Writer m
, outputWriterName :: T.Text
, outputWriterOptions :: WriterOptions
, outputPdfProgram :: Maybe String
}
-- | Get output settings from command line options.
-optToOutputSettings :: Opt -> PandocIO OutputSettings
+optToOutputSettings :: (PandocMonad m, MonadIO m) => Opt -> m (OutputSettings m)
optToOutputSettings opts = do
let outputFile = fromMaybe "-" (optOutputFile opts)
@@ -90,11 +90,10 @@ optToOutputSettings opts = do
then writerName
else T.toLower $ baseWriterName writerName
- (writer :: Writer PandocIO, writerExts) <-
+ (writer, writerExts) <-
if ".lua" `T.isSuffixOf` format
then return (TextWriter
- (\o d -> writeCustom (T.unpack writerName) o d)
- :: Writer PandocIO, mempty)
+ (\o d -> writeCustom (T.unpack writerName) o d), mempty)
else getWriter (T.toLower writerName)
let standalone = optStandalone opts || not (isTextFormat format) || pdfOutput