git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: Simplify imageTypeOf using getMimeType.
commita7067ab22b0ce297ccc5271fca59b9f9e787195e authorJohn MacFarlane <jgm@berkeley.edu> dateSat 30 Nov 2013, 19:43 (13 years ago) parent4501344
1 file changed+3−9
src/Text/Pandoc/Writers/EPUB.hs+3−9
src/Text/Pandoc/Writers/EPUB.hs+3−9
@@ -736,15 +736,9 @@ ppTopElement = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ++) . unEntity .
736736 unEntity (x:xs) = x : unEntity xs
737737
738738imageTypeOf :: FilePath -> Maybe String
739−imageTypeOf x = case drop 1 (map toLower (takeExtension x)) of
740− "jpg" -> Just "image/jpeg"
741− "jpeg" -> Just "image/jpeg"
742− "jfif" -> Just "image/jpeg"
743− "png" -> Just "image/png"
744− "gif" -> Just "image/gif"
745− "svg" -> Just "image/svg+xml"
746− _ -> Nothing
747−
739+imageTypeOf x = case getMimeType x of
740+ Just y@('i':'m':'a':'g':'e':_) -> Just y
741+ _ -> Nothing
748742
749743data IdentState = IdentState{
750744 chapterNumber :: Int,