Read second extension to find our inner .lhs format

.md.lhs -> will be read as markdown + lhs
.tex.lhs -> will be read as latex +lhs

markdown format is default
This commit is contained in:
Alexander Vershilov 2013-01-28 11:29:43 +04:00 committed by Jasper Van der Jeugt
parent 8daef26ac1
commit d2d52133f6

View file

@ -36,27 +36,27 @@ data FileType
--------------------------------------------------------------------------------
-- | Get the file type for a certain file. The type is determined by extension.
fileType :: FilePath -> FileType
fileType = fileType' . takeExtension
fileType = uncurry fileType' . splitExtension
where
fileType' ".css" = Css
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' ".org" = OrgMode
fileType' ".page" = Markdown
fileType' ".rst" = Rst
fileType' ".tex" = LaTeX
fileType' ".text" = PlainText
fileType' ".textile" = Textile
fileType' ".txt" = PlainText
fileType' _ = Binary -- Treat unknown files as binary
fileType' _ ".css" = Css
fileType' _ ".htm" = Html
fileType' _ ".html" = Html
fileType' f ".lhs" = LiterateHaskell (fileType' (takeExtension f))
fileType' _ ".markdown" = Markdown
fileType' _ ".md" = Markdown
fileType' _ ".mdn" = Markdown
fileType' _ ".mdown" = Markdown
fileType' _ ".mdwn" = Markdown
fileType' _ ".mkd" = Markdown
fileType' _ ".mkdwn" = Markdown
fileType' _ ".org" = OrgMode
fileType' _ ".page" = Markdown
fileType' _ ".rst" = Rst
fileType' _ ".tex" = LaTeX
fileType' _ ".text" = PlainText
fileType' _ ".textile" = Textile
fileType' _ ".txt" = PlainText
fileType' _ _ = Binary -- Treat unknown files as binary
--------------------------------------------------------------------------------