git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: replace `optionMaybe` and `fromMaybe` with `option`
6d16ea9Alexander Krotov
src/Text/Pandoc/Readers/Muse.hs+2−2
@@ -963,7 +963,7 @@ image :: PandocMonad m => MuseParser m (F Inlines)
963image = try $ do
963image = try $ do
964 string "[["
964 string "[["
965 (url, (ext, width, align)) <- manyUntil (noneOf "]") (imageExtensionAndOptions <* char ']')
965 (url, (ext, width, align)) <- manyUntil (noneOf "]") (imageExtensionAndOptions <* char ']')
966− content <- optionMaybe linkContent
966+ content <- option mempty linkContent
967 char ']'
967 char ']'
968 let widthAttr = case align of
968 let widthAttr = case align of
969 Just 'f' -> [("width", fromMaybe "100" width ++ "%"), ("height", "75%")]
969 Just 'f' -> [("width", fromMaybe "100" width ++ "%"), ("height", "75%")]
@@ -973,7 +973,7 @@ image = try $ do
973 Just 'l' -> ["align-left"]
973 Just 'l' -> ["align-left"]
974 Just 'f' -> []
974 Just 'f' -> []
975 _ -> []
975 _ -> []
976− return $ B.imageWith ("", alignClass, widthAttr) (url ++ ext) mempty <$> fromMaybe (return mempty) content
976+ return $ B.imageWith ("", alignClass, widthAttr) (url ++ ext) mempty <$> content
977 where -- Taken from muse-image-regexp defined in Emacs Muse file lisp/muse-regexps.el
977 where -- Taken from muse-image-regexp defined in Emacs Muse file lisp/muse-regexps.el
978 imageExtensions = [".eps", ".gif", ".jpg", ".jpeg", ".pbm", ".png", ".tiff", ".xbm", ".xpm"]
978 imageExtensions = [".eps", ".gif", ".jpg", ".jpeg", ".pbm", ".png", ".tiff", ".xbm", ".xpm"]
979 imageExtension = choice (try . string <$> imageExtensions)
979 imageExtension = choice (try . string <$> imageExtensions)