From eaa190f1e3029573a4bf4ecf238d3b8c236ad4fa Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Mon, 28 Jan 2013 11:36:59 +0100 Subject: Fix .tex.lhs patch, add some test cases --- src/Hakyll/Web/Pandoc/FileType.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3