on master help sign in
Added support for literate haskell files - patch by Mark Harris.
fe7182dJasper Van der Jeugt
src/Text/Hakyll/File.hs+1
@@ -56,6 +56,7 @@ toURL path = if takeExtension path `elem` [ ".markdown"
56 , ".rst"
56 , ".rst"
57 , ".text"
57 , ".text"
58 , ".tex"
58 , ".tex"
59+ , ".lhs"
59 ]
60 ]
60 then flip addExtension ".html" $ dropExtension path
61 then flip addExtension ".html" $ dropExtension path
61 else path
62 else path
src/Text/Hakyll/Page.hs+4−1
@@ -67,12 +67,15 @@ writerOptions = defaultWriterOptions
67getRenderFunction :: String -> (String -> String)
67getRenderFunction :: String -> (String -> String)
68getRenderFunction ".html" = id
68getRenderFunction ".html" = id
69getRenderFunction ext = writeHtmlString writerOptions
69getRenderFunction ext = writeHtmlString writerOptions
70− . readFunction ext readerOptions
70+ . readFunction ext (readOptions ext)
71 where
71 where
72 readFunction ".rst" = readRST
72 readFunction ".rst" = readRST
73 readFunction ".tex" = readLaTeX
73 readFunction ".tex" = readLaTeX
74 readFunction _ = readMarkdown
74 readFunction _ = readMarkdown
75
75
76+ readOptions ".lhs" = readerOptions { stateLiterateHaskell = True }
77+ readOptions _ = readerOptions
78+
76-- | Split a page into sections.
79-- | Split a page into sections.
77splitAtDelimiters :: [String] -> [[String]]
80splitAtDelimiters :: [String] -> [[String]]
78splitAtDelimiters [] = []
81splitAtDelimiters [] = []