mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
27 lines
846 B
Haskell
27 lines
846 B
Haskell
module Data.WebsiteContent
|
|
( WebsiteContent (..)
|
|
, loadWebsiteContent
|
|
) where
|
|
|
|
import ClassyPrelude.Yesod
|
|
import Text.Markdown (markdown, msXssProtect, msAddHeadingId)
|
|
|
|
data WebsiteContent = WebsiteContent
|
|
{ wcHomepage :: !Html
|
|
, wcAuthors :: !Html
|
|
, wcInstall :: !Html
|
|
}
|
|
|
|
loadWebsiteContent :: FilePath -> IO WebsiteContent
|
|
loadWebsiteContent dir = do
|
|
wcHomepage <- fmap (preEscapedToMarkup :: Text -> Html)
|
|
$ readFile $ dir </> "homepage.html"
|
|
wcAuthors <- fmap (preEscapedToMarkup :: Text -> Html)
|
|
$ readFile $ dir </> "authors.html"
|
|
wcInstall <- fmap (markdown def
|
|
{ msXssProtect = False
|
|
, msAddHeadingId = True
|
|
})
|
|
$ readFile $ dir </> "install.md"
|
|
return WebsiteContent {..}
|