From 6371ec241d63e0faf3a181aa4b08fb32ebb2eff1 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" <josephcsible@users.noreply.github.com> Date: Mon, 3 Feb 2020 11:26:00 -0500 Subject: [PATCH] Clean up overcomplicated maybe logic (#6105) We're using maybe in redundant ways. Remove it altogether in one case and simplify it to fromMaybe in another. --- src/Text/Pandoc/PDF.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index 0d9d1ab17..bd36f0d33 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -145,18 +145,16 @@ makeWithWkhtmltopdf program pdfargs writer opts doc@(Pandoc meta _) = do let args = pdfargs ++ mathArgs ++ concatMap toArgs [("page-size", getField "papersize" meta') ,("title", getField "title" meta') - ,("margin-bottom", maybe (Just "1.2in") Just + ,("margin-bottom", Just $ fromMaybe "1.2in" (getField "margin-bottom" meta')) - ,("margin-top", maybe (Just "1.25in") Just + ,("margin-top", Just $ fromMaybe "1.25in" (getField "margin-top" meta')) - ,("margin-right", maybe (Just "1.25in") Just + ,("margin-right", Just $ fromMaybe "1.25in" (getField "margin-right" meta')) - ,("margin-left", maybe (Just "1.25in") Just + ,("margin-left", Just $ fromMaybe "1.25in" (getField "margin-left" meta')) - ,("footer-html", maybe Nothing Just - (getField "footer-html" meta')) - ,("header-html", maybe Nothing Just - (getField "header-html" meta')) + ,("footer-html", getField "footer-html" meta') + ,("header-html", getField "header-html" meta') ] source <- writer opts doc verbosity <- getVerbosity