From 1e5f2f0691150ce87d0abd81ac5cd193eec4506c Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 30 Mar 2011 17:37:56 +0200 Subject: Move FileType module --- src/Hakyll.hs | 4 +-- src/Hakyll/Web/FileType.hs | 55 --------------------------------------- src/Hakyll/Web/Pandoc.hs | 2 +- src/Hakyll/Web/Pandoc/FileType.hs | 55 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 src/Hakyll/Web/FileType.hs create mode 100644 src/Hakyll/Web/Pandoc/FileType.hs (limited to 'src') diff --git a/src/Hakyll.hs b/src/Hakyll.hs index 49410a6..5fe1f26 100644 --- a/src/Hakyll.hs +++ b/src/Hakyll.hs @@ -19,11 +19,11 @@ module Hakyll , module Hakyll.Web.Blaze , module Hakyll.Web.CompressCss , module Hakyll.Web.Feed - , module Hakyll.Web.FileType , module Hakyll.Web.Page , module Hakyll.Web.Page.Metadata , module Hakyll.Web.Page.Read , module Hakyll.Web.Pandoc + , module Hakyll.Web.Pandoc.FileType , module Hakyll.Web.RelativizeUrls , module Hakyll.Web.Tags , module Hakyll.Web.Template @@ -48,11 +48,11 @@ import Hakyll.Main import Hakyll.Web.Blaze import Hakyll.Web.CompressCss import Hakyll.Web.Feed -import Hakyll.Web.FileType import Hakyll.Web.Page import Hakyll.Web.Page.Metadata import Hakyll.Web.Page.Read import Hakyll.Web.Pandoc +import Hakyll.Web.Pandoc.FileType import Hakyll.Web.RelativizeUrls import Hakyll.Web.Tags import Hakyll.Web.Template diff --git a/src/Hakyll/Web/FileType.hs b/src/Hakyll/Web/FileType.hs deleted file mode 100644 index cd1188a..0000000 --- a/src/Hakyll/Web/FileType.hs +++ /dev/null @@ -1,55 +0,0 @@ --- | A module dealing with common file extensions and associated file types. --- -module Hakyll.Web.FileType - ( FileType (..) - , fileType - , getFileType - ) where - -import System.FilePath (takeExtension) -import Control.Arrow ((>>^)) - -import Hakyll.Core.Identifier -import Hakyll.Core.Compiler - --- | Datatype to represent the different file types Hakyll can deal with by --- default --- -data FileType - = Html - | LaTeX - | LiterateHaskell FileType - | Markdown - | Rst - | PlainText - | Css - | Binary - deriving (Eq, Ord, Show, Read) - --- | Get the file type for a certain file. The type is determined by extension. --- -fileType :: FilePath -> FileType -fileType = fileType' . takeExtension - where - fileType' ".htm" = Html - fileType' ".html" = Html - fileType' ".lhs" = LiterateHaskell Markdown - fileType' ".markdown" = Markdown - fileType' ".md" = Markdown - fileType' ".mdn" = Markdown - fileType' ".mdown" = Markdown - fileType' ".mdwn" = Markdown - fileType' ".mkd" = Markdown - fileType' ".mkdwn" = Markdown - fileType' ".page" = Markdown - fileType' ".rst" = Rst - fileType' ".tex" = LaTeX - fileType' ".text" = PlainText - fileType' ".txt" = PlainText - fileType' ".css" = Css - fileType' _ = Binary -- Treat unknown files as binary - --- | Get the file type for the current file --- -getFileType :: Compiler a FileType -getFileType = getIdentifier >>^ fileType . toFilePath diff --git a/src/Hakyll/Web/Pandoc.hs b/src/Hakyll/Web/Pandoc.hs index f225997..7fc15a0 100644 --- a/src/Hakyll/Web/Pandoc.hs +++ b/src/Hakyll/Web/Pandoc.hs @@ -26,7 +26,7 @@ import Control.Category (id) import Text.Pandoc import Hakyll.Core.Compiler -import Hakyll.Web.FileType +import Hakyll.Web.Pandoc.FileType import Hakyll.Web.Page.Internal -- | Read a string using pandoc, with the default options diff --git a/src/Hakyll/Web/Pandoc/FileType.hs b/src/Hakyll/Web/Pandoc/FileType.hs new file mode 100644 index 0000000..670f1eb --- /dev/null +++ b/src/Hakyll/Web/Pandoc/FileType.hs @@ -0,0 +1,55 @@ +-- | A module dealing with pandoc file extensions and associated file types +-- +module Hakyll.Web.Pandoc.FileType + ( FileType (..) + , fileType + , getFileType + ) where + +import System.FilePath (takeExtension) +import Control.Arrow ((>>^)) + +import Hakyll.Core.Identifier +import Hakyll.Core.Compiler + +-- | Datatype to represent the different file types Hakyll can deal with by +-- default +-- +data FileType + = Html + | LaTeX + | LiterateHaskell FileType + | Markdown + | Rst + | PlainText + | Css + | Binary + deriving (Eq, Ord, Show, Read) + +-- | Get the file type for a certain file. The type is determined by extension. +-- +fileType :: FilePath -> FileType +fileType = fileType' . takeExtension + where + fileType' ".htm" = Html + fileType' ".html" = Html + fileType' ".lhs" = LiterateHaskell Markdown + fileType' ".markdown" = Markdown + fileType' ".md" = Markdown + fileType' ".mdn" = Markdown + fileType' ".mdown" = Markdown + fileType' ".mdwn" = Markdown + fileType' ".mkd" = Markdown + fileType' ".mkdwn" = Markdown + fileType' ".page" = Markdown + fileType' ".rst" = Rst + fileType' ".tex" = LaTeX + fileType' ".text" = PlainText + fileType' ".txt" = PlainText + fileType' ".css" = Css + fileType' _ = Binary -- Treat unknown files as binary + +-- | Get the file type for the current file +-- +getFileType :: Compiler a FileType +getFileType = getIdentifier >>^ fileType . toFilePath -- cgit v1.2.3