yesod-form: blaze-html 0.5

This commit is contained in:
Michael Snoyman 2012-04-23 13:49:52 +03:00
parent 4bb2c33bfe
commit 4789a1d073
6 changed files with 50 additions and 3 deletions

View File

@ -3,6 +3,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP #-}
module Yesod.Form.Fields module Yesod.Form.Fields
( -- * i18n ( -- * i18n
FormMessage (..) FormMessage (..)
@ -50,7 +51,14 @@ import Yesod.Handler (getMessageRender)
import Yesod.Widget (toWidget, whamlet, GWidget) import Yesod.Widget (toWidget, whamlet, GWidget)
import Yesod.Message (RenderMessage (renderMessage), SomeMessage (..)) import Yesod.Message (RenderMessage (renderMessage), SomeMessage (..))
import Text.Hamlet import Text.Hamlet
#if MIN_VERSION_blaze_html(0, 5, 0)
import Text.Blaze (ToMarkup (toMarkup), preEscapedToMarkup, unsafeByteString)
#define ToHtml ToMarkup
#define toHtml toMarkup
#define preEscapedText preEscapedToMarkup
#else
import Text.Blaze (ToHtml (..), preEscapedText, unsafeByteString) import Text.Blaze (ToHtml (..), preEscapedText, unsafeByteString)
#endif
import Text.Cassius import Text.Cassius
import Data.Time (Day, TimeOfDay(..)) import Data.Time (Day, TimeOfDay(..))
import qualified Text.Email.Validate as Email import qualified Text.Email.Validate as Email

View File

@ -2,6 +2,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP #-}
module Yesod.Form.Functions module Yesod.Form.Functions
( -- * Running in MForm monad ( -- * Running in MForm monad
newFormIdent newFormIdent
@ -43,7 +44,13 @@ import Control.Arrow (second)
import Control.Monad.Trans.RWS (ask, get, put, runRWST, tell, evalRWST) import Control.Monad.Trans.RWS (ask, get, put, runRWST, tell, evalRWST)
import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Class (lift)
import Control.Monad (liftM, join) import Control.Monad (liftM, join)
#if MIN_VERSION_blaze_html(0, 5, 0)
import Text.Blaze (Markup, toMarkup)
#define Html Markup
#define toHtml toMarkup
#else
import Text.Blaze (Html, toHtml) import Text.Blaze (Html, toHtml)
#endif
import Yesod.Handler (GHandler, getRequest, runRequestBody, newIdent, getYesod) import Yesod.Handler (GHandler, getRequest, runRequestBody, newIdent, getYesod)
import Yesod.Core (RenderMessage, SomeMessage (..)) import Yesod.Core (RenderMessage, SomeMessage (..))
import Yesod.Widget (GWidget, whamlet) import Yesod.Widget (GWidget, whamlet)

View File

@ -2,6 +2,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP#-}
module Yesod.Form.MassInput module Yesod.Form.MassInput
( inputList ( inputList
, massDivs , massDivs
@ -14,7 +15,11 @@ import Yesod.Form.Fields (boolField)
import Yesod.Widget (GWidget, whamlet) import Yesod.Widget (GWidget, whamlet)
import Yesod.Message (RenderMessage) import Yesod.Message (RenderMessage)
import Yesod.Handler (newIdent, GHandler) import Yesod.Handler (newIdent, GHandler)
#if MIN_VERSION_blaze_html(0, 5, 0)
import Text.Blaze.Html (Html)
#else
import Text.Blaze (Html) import Text.Blaze (Html)
#endif
import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.RWS (get, put, ask) import Control.Monad.Trans.RWS (get, put, ask)
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)

View File

@ -3,6 +3,7 @@
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoMonomorphismRestriction #-} -- FIXME remove {-# LANGUAGE NoMonomorphismRestriction #-} -- FIXME remove
{-# LANGUAGE CPP #-}
-- | Provide the user with a rich text editor. -- | Provide the user with a rich text editor.
module Yesod.Form.Nic module Yesod.Form.Nic
( YesodNic (..) ( YesodNic (..)
@ -16,8 +17,14 @@ import Yesod.Widget
import Text.HTML.SanitizeXSS (sanitizeBalance) import Text.HTML.SanitizeXSS (sanitizeBalance)
import Text.Hamlet (Html, shamlet) import Text.Hamlet (Html, shamlet)
import Text.Julius (julius) import Text.Julius (julius)
import Text.Blaze.Renderer.String (renderHtml) #if MIN_VERSION_blaze_html(0, 5, 0)
import Text.Blaze (preEscapedToMarkup)
import Text.Blaze.Html.Renderer.String (renderHtml)
#define preEscapedText preEscapedToMarkup
#else
import Text.Blaze (preEscapedText) import Text.Blaze (preEscapedText)
import Text.Blaze.Renderer.String (renderHtml)
#endif
import Data.Text (Text, pack) import Data.Text (Text, pack)
import Data.Maybe (listToMaybe) import Data.Maybe (listToMaybe)

View File

@ -1,6 +1,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE CPP #-}
module Yesod.Form.Types module Yesod.Form.Types
( -- * Helpers ( -- * Helpers
Enctype (..) Enctype (..)
@ -22,7 +23,14 @@ import Control.Monad.Trans.RWS (RWST)
import Yesod.Request (FileInfo) import Yesod.Request (FileInfo)
import Data.Text (Text) import Data.Text (Text)
import Data.Monoid (Monoid (..)) import Data.Monoid (Monoid (..))
#if MIN_VERSION_blaze_html(0, 5, 0)
import Text.Blaze (Markup, ToMarkup (toMarkup))
#define Html Markup
#define ToHtml ToMarkup
#define toHtml toMarkup
#else
import Text.Blaze (Html, ToHtml (toHtml)) import Text.Blaze (Html, ToHtml (toHtml))
#endif
import Control.Applicative ((<$>), Applicative (..)) import Control.Applicative ((<$>), Applicative (..))
import Control.Monad (liftM) import Control.Monad (liftM)
import Data.String (IsString (..)) import Data.String (IsString (..))

View File

@ -1,5 +1,5 @@
name: yesod-form name: yesod-form
version: 1.0.0.2 version: 1.0.0.3
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>
@ -12,6 +12,10 @@ build-type: Simple
homepage: http://www.yesodweb.com/ homepage: http://www.yesodweb.com/
description: Form handling support for Yesod Web Framework description: Form handling support for Yesod Web Framework
flag blaze_html_0_5
description: use blaze-html 0.5 and blaze-markup 0.5
default: False
library library
build-depends: base >= 4 && < 5 build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1 , yesod-core >= 1.0 && < 1.1
@ -28,11 +32,19 @@ library
, blaze-builder >= 0.2.1.4 && < 0.4 , blaze-builder >= 0.2.1.4 && < 0.4
, network >= 2.2 && < 2.4 , network >= 2.2 && < 2.4
, email-validate >= 0.2.6 && < 0.3 , email-validate >= 0.2.6 && < 0.3
, blaze-html >= 0.4.1.3 && < 0.5
, bytestring >= 0.9.1.4 && < 0.10 , bytestring >= 0.9.1.4 && < 0.10
, text >= 0.9 && < 1.0 , text >= 0.9 && < 1.0
, wai >= 1.2 && < 1.3 , wai >= 1.2 && < 1.3
, containers >= 0.2 && < 0.5 , containers >= 0.2 && < 0.5
if flag(blaze_html_0_5)
build-depends:
blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
else
build-depends:
blaze-html >= 0.4 && < 0.5
exposed-modules: Yesod.Form exposed-modules: Yesod.Form
Yesod.Form.Class Yesod.Form.Class
Yesod.Form.Types Yesod.Form.Types