BlazeHtml 0.1
This commit is contained in:
parent
72aad8659d
commit
bc7fc91606
@ -24,7 +24,7 @@ import Web.Routes.Quasi (Routes)
|
||||
--
|
||||
-- > PageContent url -> Hamlet url
|
||||
data PageContent url = PageContent
|
||||
{ pageTitle :: Html
|
||||
{ pageTitle :: Html ()
|
||||
, pageHead :: Hamlet url
|
||||
, pageBody :: Hamlet url
|
||||
}
|
||||
|
||||
@ -306,14 +306,14 @@ msgKey = "_MSG"
|
||||
-- | Sets a message in the user's session.
|
||||
--
|
||||
-- See 'getMessage'.
|
||||
setMessage :: Html -> GHandler sub master ()
|
||||
setMessage :: Html () -> GHandler sub master ()
|
||||
setMessage = setSession msgKey . L.toString . renderHtml
|
||||
|
||||
-- | Gets the message in the user's session, if available, and then clears the
|
||||
-- variable.
|
||||
--
|
||||
-- See 'setMessage'.
|
||||
getMessage :: GHandler sub master (Maybe Html)
|
||||
getMessage :: GHandler sub master (Maybe (Html ()))
|
||||
getMessage = do
|
||||
clearSession msgKey
|
||||
fmap (fmap preEscapedString) $ lookupSession msgKey
|
||||
|
||||
@ -44,10 +44,10 @@ data AtomFeedEntry url = AtomFeedEntry
|
||||
{ atomEntryLink :: url
|
||||
, atomEntryUpdated :: UTCTime
|
||||
, atomEntryTitle :: String
|
||||
, atomEntryContent :: Html
|
||||
, atomEntryContent :: Html ()
|
||||
}
|
||||
|
||||
xmlns :: AtomFeed url -> Html
|
||||
xmlns :: AtomFeed url -> Html ()
|
||||
xmlns _ = preEscapedString "http://www.w3.org/2005/Atom"
|
||||
|
||||
template :: AtomFeed url -> Hamlet url
|
||||
|
||||
@ -50,7 +50,7 @@ data SitemapUrl url = SitemapUrl
|
||||
, priority :: Double
|
||||
}
|
||||
|
||||
sitemapNS :: Html
|
||||
sitemapNS :: Html ()
|
||||
sitemapNS = string "http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
|
||||
template :: [SitemapUrl url] -> Hamlet url
|
||||
|
||||
@ -41,7 +41,7 @@ import Yesod.Content
|
||||
-- This is an opaque type to avoid any possible insertion of non-JSON content.
|
||||
-- Due to the limited nature of the JSON format, you can create any valid JSON
|
||||
-- document you wish using only 'jsonScalar', 'jsonList' and 'jsonMap'.
|
||||
newtype Json = Json { unJson :: Html }
|
||||
newtype Json = Json { unJson :: Html () }
|
||||
deriving Monoid
|
||||
|
||||
-- | Extract the final result from the given 'Json' value.
|
||||
@ -61,10 +61,10 @@ jsonToRepJson = fmap RepJson . jsonToContent
|
||||
-- * Performs JSON encoding.
|
||||
--
|
||||
-- * Wraps the resulting string in quotes.
|
||||
jsonScalar :: Html -> Json
|
||||
jsonScalar :: Html () -> Json
|
||||
jsonScalar s = Json $ mconcat
|
||||
[ preEscapedString "\""
|
||||
, unsafeBytestring $ S.concat $ L.toChunks $ encodeJson $ renderHtml s
|
||||
, unsafeByteString $ S.concat $ L.toChunks $ encodeJson $ renderHtml s
|
||||
, preEscapedString "\""
|
||||
]
|
||||
where
|
||||
|
||||
Loading…
Reference in New Issue
Block a user