on master help sign in
Added support for literate haskell files - patch by Mark Harris.
commitfe7182d28856514d2e19a3ef588282129cc21fe2 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSun 24 Jan 2010, 19:14 (17 years ago) parentd97a53b
2 files changed+5−1
src/Text/Hakyll/File.hs+1 src/Text/Hakyll/Page.hs+4−1
src/Text/Hakyll/File.hs+1
@@ -56,6 +56,7 @@ toURL path = if takeExtension path `elem` [ ".markdown"
5656 , ".rst"
5757 , ".text"
5858 , ".tex"
59+ , ".lhs"
5960 ]
6061 then flip addExtension ".html" $ dropExtension path
6162 else path
src/Text/Hakyll/Page.hs+4−1
@@ -67,12 +67,15 @@ writerOptions = defaultWriterOptions
6767getRenderFunction :: String -> (String -> String)
6868getRenderFunction ".html" = id
6969getRenderFunction ext = writeHtmlString writerOptions
70− . readFunction ext readerOptions
70+ . readFunction ext (readOptions ext)
7171 where
7272 readFunction ".rst" = readRST
7373 readFunction ".tex" = readLaTeX
7474 readFunction _ = readMarkdown
7575
76+ readOptions ".lhs" = readerOptions { stateLiterateHaskell = True }
77+ readOptions _ = readerOptions
78+
7679-- | Split a page into sections.
7780splitAtDelimiters :: [String] -> [[String]]
7881splitAtDelimiters [] = []