summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-03-04 11:46:06 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-03-04 11:46:06 +0100
commitbe685e6fcdbdb8d1bf49a09212413922a2e1ea82 (patch)
tree63ff2b5ad4b68e11304db7d6392c9a617b4c808f /src/Hakyll/Web
parent40f503e0802a9be07ebd5fa965dec0e65f316f90 (diff)
downloadhakyll-be685e6fcdbdb8d1bf49a09212413922a2e1ea82.tar.gz
Add BlazeHtml integration
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r--src/Hakyll/Web/Blaze.hs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Hakyll/Web/Blaze.hs b/src/Hakyll/Web/Blaze.hs
new file mode 100644
index 0000000..e83b340
--- /dev/null
+++ b/src/Hakyll/Web/Blaze.hs
@@ -0,0 +1,34 @@
+-- | Module providing BlazeHtml support for hakyll
+--
+module Hakyll.Web.Blaze
+ ( getFieldHtml
+ , getFieldHtml'
+ , getBodyHtml
+ , getBodyHtml'
+ ) where
+
+import Text.Blaze (Html, toHtml, preEscapedString)
+
+import Hakyll.Web.Page
+import Hakyll.Web.Page.Metadata
+
+-- | Get a field from a page and convert it to HTML. This version does escape
+-- the given HTML
+--
+getFieldHtml :: String -> Page a -> Html
+getFieldHtml key = preEscapedString . getField key
+
+-- | Version of 'getFieldHtml' that escapes the HTML content
+--
+getFieldHtml' :: String -> Page a -> Html
+getFieldHtml' key = toHtml . getField key
+
+-- | Get the body as HTML
+--
+getBodyHtml :: Page String -> Html
+getBodyHtml = preEscapedString . pageBody
+
+-- | Version of 'getBodyHtml' that escapes the HTML content
+--
+getBodyHtml' :: Page String -> Html
+getBodyHtml' = toHtml . pageBody