aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJoseph C. Sible <josephcsible@users.noreply.github.com>2020-02-03 23:31:05 -0500
committerGitHub <noreply@github.com>2020-02-03 20:31:05 -0800
commit1ea5b1802072fe2724977fa859c0e5b48f15917d (patch)
treef675b874a02776c8b5809a5dfa73fa2ca967c1ef /src/Text/Pandoc/Readers
parentd9b1776336db06306562c4b5648716196261b548 (diff)
downloadpandoc-1ea5b1802072fe2724977fa859c0e5b48f15917d.tar.gz
Swap suboptimal uses of maybe and fromMaybe (#6111)
Anywhere "maybe" is used with "id" as its second argument, using "fromMaybe" instead will simplify the code. Conversely, anywhere "fromMaybe" is used with the result of "fmap" or "<$>" as its second argument, using "maybe" instead will simplify the code.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/EPUB.hs2
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index 93ddeb9ee..bcff7e4b8 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -67,7 +67,7 @@ archiveToEPUB os archive = do
(coverId, meta) <- parseMeta content
(cover, items) <- parseManifest content coverId
-- No need to collapse here as the image path is from the manifest file
- let coverDoc = fromMaybe mempty (imageToPandoc <$> cover)
+ let coverDoc = maybe mempty imageToPandoc cover
spine <- parseSpine items content
let escapedSpine = map (escapeURI . T.pack . takeFileName . fst) spine
Pandoc _ bs <-
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 9fd334e62..979bb2de5 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -812,8 +812,8 @@ pSpan = try $ do
let isSmallCaps = fontVariant == "small-caps" || "smallcaps" `elem` classes
where styleAttr = fromMaybe "" $ lookup "style" attr
fontVariant = fromMaybe "" $ pickStyleAttrProps ["font-variant"] styleAttr
- classes = fromMaybe [] $
- T.words <$> lookup "class" attr
+ classes = maybe []
+ T.words $ lookup "class" attr
let tag = if isSmallCaps then B.smallcaps else B.spanWith (mkAttr attr)
return $ tag contents