aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/App/OutputSettings.hs7
-rw-r--r--src/Text/Pandoc/Readers/Org/Blocks.hs4
2 files changed, 3 insertions, 8 deletions
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
index 3363acbb9..0dea81c38 100644
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -65,9 +65,7 @@ optToOutputSettings opts = do
mapM_ (UTF8.hPutStrLn stdout) (fromMaybe [] $ optInputFiles opts)
exitSuccess
- epubMetadata <- case optEpubMetadata opts of
- Nothing -> return Nothing
- Just fp -> Just <$> readUtf8File fp
+ epubMetadata <- traverse readUtf8File $ optEpubMetadata opts
let pdfOutput = map toLower (takeExtension outputFile) == ".pdf" ||
optTo opts == Just "pdf"
@@ -112,8 +110,7 @@ optToOutputSettings opts = do
syntaxMap <- foldM addSyntaxMap defaultSyntaxMap
(optSyntaxDefinitions opts)
- hlStyle <- maybe (return Nothing) (fmap Just . lookupHighlightStyle . T.unpack)
- (optHighlightStyle opts)
+ hlStyle <- traverse (lookupHighlightStyle . T.unpack) $ optHighlightStyle opts
let setVariableM k v = return . setVariable k v
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
index dc7a26aca..8aceebc07 100644
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -130,9 +130,7 @@ blockAttributes = try $ do
let kvAttrs = foldl' (appendValues "ATTR_HTML") Nothing kv
let name = lookup "NAME" kv
let label = lookup "LABEL" kv
- caption' <- case caption of
- Nothing -> return Nothing
- Just s -> Just <$> parseFromString inlines (s <> "\n")
+ caption' <- traverse (parseFromString inlines . (<> "\n")) caption
kvAttrs' <- parseFromString keyValues . (<> "\n") $ fromMaybe mempty kvAttrs
return BlockAttributes
{ blockAttrName = name