diff options
Diffstat (limited to 'src/Hakyll/Web/Pandoc')
-rw-r--r-- | src/Hakyll/Web/Pandoc/FileType.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Hakyll/Web/Pandoc/FileType.hs b/src/Hakyll/Web/Pandoc/FileType.hs index 28698a7..46c8e24 100644 --- a/src/Hakyll/Web/Pandoc/FileType.hs +++ b/src/Hakyll/Web/Pandoc/FileType.hs @@ -8,7 +8,7 @@ module Hakyll.Web.Pandoc.FileType -------------------------------------------------------------------------------- -import System.FilePath (takeExtension) +import System.FilePath (splitExtension) -------------------------------------------------------------------------------- @@ -36,12 +36,16 @@ data FileType -------------------------------------------------------------------------------- -- | Get the file type for a certain file. The type is determined by extension. fileType :: FilePath -> FileType -fileType = uncurry fileType' . splitExtension +fileType = uncurry fileType' . splitExtension where fileType' _ ".css" = Css fileType' _ ".htm" = Html fileType' _ ".html" = Html - fileType' f ".lhs" = LiterateHaskell (fileType' (takeExtension f)) + fileType' f ".lhs" = LiterateHaskell $ case fileType f of + -- If no extension is given, default to Markdown + LiterateHaskell + Binary -> Markdown + -- Otherwise, LaTeX + LiterateHaskell or whatever the user specified + x -> x fileType' _ ".markdown" = Markdown fileType' _ ".md" = Markdown fileType' _ ".mdn" = Markdown |