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 GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP #-}
module Yesod.Form.Fields
( -- * i18n
FormMessage (..)
@ -50,7 +51,14 @@ import Yesod.Handler (getMessageRender)
import Yesod.Widget (toWidget, whamlet, GWidget)
import Yesod.Message (RenderMessage (renderMessage), SomeMessage (..))
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)
#endif
import Text.Cassius
import Data.Time (Day, TimeOfDay(..))
import qualified Text.Email.Validate as Email

View File

@ -2,6 +2,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP #-}
module Yesod.Form.Functions
( -- * Running in MForm monad
newFormIdent
@ -43,7 +44,13 @@ import Control.Arrow (second)
import Control.Monad.Trans.RWS (ask, get, put, runRWST, tell, evalRWST)
import Control.Monad.Trans.Class (lift)
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)
#endif
import Yesod.Handler (GHandler, getRequest, runRequestBody, newIdent, getYesod)
import Yesod.Core (RenderMessage, SomeMessage (..))
import Yesod.Widget (GWidget, whamlet)

View File

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

View File

@ -3,6 +3,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoMonomorphismRestriction #-} -- FIXME remove
{-# LANGUAGE CPP #-}
-- | Provide the user with a rich text editor.
module Yesod.Form.Nic
( YesodNic (..)
@ -16,8 +17,14 @@ import Yesod.Widget
import Text.HTML.SanitizeXSS (sanitizeBalance)
import Text.Hamlet (Html, shamlet)
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.Renderer.String (renderHtml)
#endif
import Data.Text (Text, pack)
import Data.Maybe (listToMaybe)

View File

@ -1,6 +1,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE CPP #-}
module Yesod.Form.Types
( -- * Helpers
Enctype (..)
@ -22,7 +23,14 @@ import Control.Monad.Trans.RWS (RWST)
import Yesod.Request (FileInfo)
import Data.Text (Text)
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))
#endif
import Control.Applicative ((<$>), Applicative (..))
import Control.Monad (liftM)
import Data.String (IsString (..))

View File

@ -1,5 +1,5 @@
name: yesod-form
version: 1.0.0.2
version: 1.0.0.3
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -12,6 +12,10 @@ build-type: Simple
homepage: http://www.yesodweb.com/
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
build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1
@ -28,11 +32,19 @@ library
, blaze-builder >= 0.2.1.4 && < 0.4
, network >= 2.2 && < 2.4
, email-validate >= 0.2.6 && < 0.3
, blaze-html >= 0.4.1.3 && < 0.5
, bytestring >= 0.9.1.4 && < 0.10
, text >= 0.9 && < 1.0
, wai >= 1.2 && < 1.3
, 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
Yesod.Form.Class
Yesod.Form.Types