diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-11-30 19:43:24 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-11-30 19:43:42 -0800 |
commit | a7067ab22b0ce297ccc5271fca59b9f9e787195e (patch) | |
tree | 66e860139236ed864f6bad498417ebf9fdf7f389 | |
parent | 4501344d45947bee79707522efdc77bfdc650bd6 (diff) | |
download | pandoc-a7067ab22b0ce297ccc5271fca59b9f9e787195e.tar.gz |
EPUB writer: Simplify imageTypeOf using getMimeType.
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 6e1a391af..7be7eb368 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -736,15 +736,9 @@ ppTopElement = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ++) . unEntity . unEntity (x:xs) = x : unEntity xs imageTypeOf :: FilePath -> Maybe String -imageTypeOf x = case drop 1 (map toLower (takeExtension x)) of - "jpg" -> Just "image/jpeg" - "jpeg" -> Just "image/jpeg" - "jfif" -> Just "image/jpeg" - "png" -> Just "image/png" - "gif" -> Just "image/gif" - "svg" -> Just "image/svg+xml" - _ -> Nothing - +imageTypeOf x = case getMimeType x of + Just y@('i':'m':'a':'g':'e':_) -> Just y + _ -> Nothing data IdentState = IdentState{ chapterNumber :: Int, |