Changes to Css and Javascript datatypes
This commit is contained in:
parent
055da0febe
commit
06db8b9508
@ -50,7 +50,9 @@ import Text.Hamlet
|
|||||||
import Text.Cassius
|
import Text.Cassius
|
||||||
import Text.Julius
|
import Text.Julius
|
||||||
import Web.Routes
|
import Web.Routes
|
||||||
import Blaze.ByteString.Builder (toLazyByteString)
|
import Text.Blaze (preEscapedLazyText)
|
||||||
|
import Data.Text.Lazy.Builder (toLazyText)
|
||||||
|
import Data.Text.Lazy.Encoding (encodeUtf8)
|
||||||
|
|
||||||
#if TEST
|
#if TEST
|
||||||
import Test.Framework (testGroup, Test)
|
import Test.Framework (testGroup, Test)
|
||||||
@ -382,12 +384,10 @@ widgetToPageContent (GWidget w) = do
|
|||||||
let scripts = map (locationToHamlet . unScript) $ runUniqueList scripts'
|
let scripts = map (locationToHamlet . unScript) $ runUniqueList scripts'
|
||||||
let stylesheets = map (locationToHamlet . unStylesheet)
|
let stylesheets = map (locationToHamlet . unStylesheet)
|
||||||
$ runUniqueList stylesheets'
|
$ runUniqueList stylesheets'
|
||||||
-- FIXME change hamlet: cassius and julius should be structured datatypes so we don't need to do this
|
let cssToHtml = preEscapedLazyText . renderCss
|
||||||
let unsafeLazyByteString = mconcat . map unsafeByteString . L.toChunks
|
|
||||||
let cssToHtml (Css b) = unsafeLazyByteString $ toLazyByteString b
|
|
||||||
celper :: Cassius url -> Hamlet url
|
celper :: Cassius url -> Hamlet url
|
||||||
celper = fmap cssToHtml
|
celper = fmap cssToHtml
|
||||||
jsToHtml (Javascript b) = unsafeLazyByteString $ toLazyByteString b
|
jsToHtml (Javascript b) = preEscapedLazyText $ toLazyText b
|
||||||
jelper :: Julius url -> Hamlet url
|
jelper :: Julius url -> Hamlet url
|
||||||
jelper = fmap jsToHtml
|
jelper = fmap jsToHtml
|
||||||
|
|
||||||
@ -402,14 +402,14 @@ widgetToPageContent (GWidget w) = do
|
|||||||
Nothing -> return Nothing
|
Nothing -> return Nothing
|
||||||
Just s -> do
|
Just s -> do
|
||||||
x <- addStaticContent "css" "text/css; charset=utf-8"
|
x <- addStaticContent "css" "text/css; charset=utf-8"
|
||||||
$ renderCassius render s
|
$ encodeUtf8 $ renderCassius render s
|
||||||
return $ renderLoc x
|
return $ renderLoc x
|
||||||
jsLoc <-
|
jsLoc <-
|
||||||
case jscript of
|
case jscript of
|
||||||
Nothing -> return Nothing
|
Nothing -> return Nothing
|
||||||
Just s -> do
|
Just s -> do
|
||||||
x <- addStaticContent "js" "text/javascript; charset=utf-8"
|
x <- addStaticContent "js" "text/javascript; charset=utf-8"
|
||||||
$ renderJulius render s
|
$ encodeUtf8 $ renderJulius render s
|
||||||
return $ renderLoc x
|
return $ renderLoc x
|
||||||
|
|
||||||
let head'' =
|
let head'' =
|
||||||
|
|||||||
@ -47,7 +47,7 @@ library
|
|||||||
, monad-peel >= 0.1 && < 0.2
|
, monad-peel >= 0.1 && < 0.2
|
||||||
, enumerator >= 0.4 && < 0.5
|
, enumerator >= 0.4 && < 0.5
|
||||||
, cookie >= 0.0 && < 0.1
|
, cookie >= 0.0 && < 0.1
|
||||||
, blaze-html >= 0.3.0.4 && < 0.4
|
, blaze-html >= 0.3.2.1 && < 0.4
|
||||||
exposed-modules: Yesod.Content
|
exposed-modules: Yesod.Content
|
||||||
Yesod.Core
|
Yesod.Core
|
||||||
Yesod.Dispatch
|
Yesod.Dispatch
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user