From be685e6fcdbdb8d1bf49a09212413922a2e1ea82 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 4 Mar 2011 11:46:06 +0100 Subject: Add BlazeHtml integration --- src/Hakyll/Web/Blaze.hs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/Hakyll/Web/Blaze.hs (limited to 'src/Hakyll/Web') 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 -- cgit v1.2.3