From fe7182d28856514d2e19a3ef588282129cc21fe2 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 24 Jan 2010 19:14:16 +0100 Subject: Added support for literate haskell files - patch by Mark Harris. --- src/Text/Hakyll/File.hs | 1 + src/Text/Hakyll/Page.hs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs index 852436b..992490c 100644 --- a/src/Text/Hakyll/File.hs +++ b/src/Text/Hakyll/File.hs @@ -56,6 +56,7 @@ toURL path = if takeExtension path `elem` [ ".markdown" , ".rst" , ".text" , ".tex" + , ".lhs" ] then flip addExtension ".html" $ dropExtension path else path diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs index e522605..7aa6a25 100644 --- a/src/Text/Hakyll/Page.hs +++ b/src/Text/Hakyll/Page.hs @@ -67,12 +67,15 @@ writerOptions = defaultWriterOptions getRenderFunction :: String -> (String -> String) getRenderFunction ".html" = id getRenderFunction ext = writeHtmlString writerOptions - . readFunction ext readerOptions + . readFunction ext (readOptions ext) where readFunction ".rst" = readRST readFunction ".tex" = readLaTeX readFunction _ = readMarkdown + readOptions ".lhs" = readerOptions { stateLiterateHaskell = True } + readOptions _ = readerOptions + -- | Split a page into sections. splitAtDelimiters :: [String] -> [[String]] splitAtDelimiters [] = [] -- cgit v1.2.3