module Hakyll.Web.Pandoc.FileType
( FileType (..)
, fileType
, itemFileType
) where
import System.FilePath (splitExtension)
import Hakyll.Core.Identifier
import Hakyll.Core.Item
data FileType
= Binary
| Css
| DocBook
| Html
| Jupyter
| LaTeX
| LiterateHaskell FileType
| Markdown
| MediaWiki
| OrgMode
| PlainText
| Rst
| Textile
deriving (FileType -> FileType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileType -> FileType -> Bool
$c/= :: FileType -> FileType -> Bool
== :: FileType -> FileType -> Bool
$c== :: FileType -> FileType -> Bool
Eq, Eq FileType
FileType -> FileType -> Bool
FileType -> FileType -> Ordering
FileType -> FileType -> FileType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FileType -> FileType -> FileType
$cmin :: FileType -> FileType -> FileType
max :: FileType -> FileType -> FileType
$cmax :: FileType -> FileType -> FileType
>= :: FileType -> FileType -> Bool
$c>= :: FileType -> FileType -> Bool
> :: FileType -> FileType -> Bool
$c> :: FileType -> FileType -> Bool
<= :: FileType -> FileType -> Bool
$c<= :: FileType -> FileType -> Bool
< :: FileType -> FileType -> Bool
$c< :: FileType -> FileType -> Bool
compare :: FileType -> FileType -> Ordering
$ccompare :: FileType -> FileType -> Ordering
Ord, Int -> FileType -> ShowS
[FileType] -> ShowS
FileType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileType] -> ShowS
$cshowList :: [FileType] -> ShowS
show :: FileType -> String
$cshow :: FileType -> String
showsPrec :: Int -> FileType -> ShowS
$cshowsPrec :: Int -> FileType -> ShowS
Show, ReadPrec [FileType]
ReadPrec FileType
Int -> ReadS FileType
ReadS [FileType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileType]
$creadListPrec :: ReadPrec [FileType]
readPrec :: ReadPrec FileType
$creadPrec :: ReadPrec FileType
readList :: ReadS [FileType]
$creadList :: ReadS [FileType]
readsPrec :: Int -> ReadS FileType
$creadsPrec :: Int -> ReadS FileType
Read)
fileType :: FilePath -> FileType
fileType :: String -> FileType
fileType = forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry String -> String -> FileType
fileType' forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> (String, String)
splitExtension
where
fileType' :: String -> String -> FileType
fileType' String
_ String
".css" = FileType
Css
fileType' String
_ String
".dbk" = FileType
DocBook
fileType' String
_ String
".ipynb" = FileType
Jupyter
fileType' String
_ String
".htm" = FileType
Html
fileType' String
_ String
".html" = FileType
Html
fileType' String
f String
".lhs" = FileType -> FileType
LiterateHaskell forall a b. (a -> b) -> a -> b
$ case String -> FileType
fileType String
f of
FileType
Binary -> FileType
Markdown
FileType
x -> FileType
x
fileType' String
_ String
".markdown" = FileType
Markdown
fileType' String
_ String
".mediawiki" = FileType
MediaWiki
fileType' String
_ String
".md" = FileType
Markdown
fileType' String
_ String
".mdn" = FileType
Markdown
fileType' String
_ String
".mdown" = FileType
Markdown
fileType' String
_ String
".mdwn" = FileType
Markdown
fileType' String
_ String
".mkd" = FileType
Markdown
fileType' String
_ String
".mkdwn" = FileType
Markdown
fileType' String
_ String
".org" = FileType
OrgMode
fileType' String
_ String
".page" = FileType
Markdown
fileType' String
_ String
".rst" = FileType
Rst
fileType' String
_ String
".tex" = FileType
LaTeX
fileType' String
_ String
".text" = FileType
PlainText
fileType' String
_ String
".textile" = FileType
Textile
fileType' String
_ String
".txt" = FileType
PlainText
fileType' String
_ String
".wiki" = FileType
MediaWiki
fileType' String
_ String
_ = FileType
Binary
itemFileType :: Item a -> FileType
itemFileType :: forall a. Item a -> FileType
itemFileType = String -> FileType
fileType forall b c a. (b -> c) -> (a -> b) -> a -> c
. Identifier -> String
toFilePath forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Item a -> Identifier
itemIdentifier