summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-24 19:14:16 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-24 19:14:16 +0100
commitfe7182d28856514d2e19a3ef588282129cc21fe2 (patch)
tree6d5e9397e56ee68b7ea6e6bfa09b049548d11dc6
parentd97a53b6b490bc997cfee6d2f16ab7cba9499347 (diff)
downloadhakyll-fe7182d28856514d2e19a3ef588282129cc21fe2.tar.gz
Added support for literate haskell files - patch by Mark Harris.
-rw-r--r--src/Text/Hakyll/File.hs1
-rw-r--r--src/Text/Hakyll/Page.hs5
2 files changed, 5 insertions, 1 deletions
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 [] = []