atomLink and sanitizeBalance

This commit is contained in:
Michael Snoyman 2010-11-02 13:17:11 +02:00
parent 5978b71559
commit 97819f0ad7
4 changed files with 15 additions and 6 deletions

View File

@ -12,7 +12,7 @@ import Yesod.Handler
import Yesod.Form.Core import Yesod.Form.Core
import Yesod.Hamlet import Yesod.Hamlet
import Yesod.Widget import Yesod.Widget
import Text.HTML.SanitizeXSS (sanitizeXSS) import Text.HTML.SanitizeXSS (sanitizeBalance)
import Yesod.Internal (lbsToChars) import Yesod.Internal (lbsToChars)
@ -32,7 +32,7 @@ maybeNicHtmlField = optionalFieldHelper nicHtmlFieldProfile
nicHtmlFieldProfile :: YesodNic y => FieldProfile sub y Html nicHtmlFieldProfile :: YesodNic y => FieldProfile sub y Html
nicHtmlFieldProfile = FieldProfile nicHtmlFieldProfile = FieldProfile
{ fpParse = Right . preEscapedString . sanitizeXSS { fpParse = Right . preEscapedString . sanitizeBalance
, fpRender = lbsToChars . renderHtml , fpRender = lbsToChars . renderHtml
, fpWidget = \theId name val _isReq -> do , fpWidget = \theId name val _isReq -> do
addHtml [$hamlet|%textarea.html#$theId$!name=$name$ $val$|] addHtml [$hamlet|%textarea.html#$theId$!name=$name$ $val$|]

View File

@ -24,7 +24,7 @@ import Data.Time (Day, TimeOfDay(..))
import qualified Text.Email.Validate as Email import qualified Text.Email.Validate as Email
import Network.URI (parseURI) import Network.URI (parseURI)
import Database.Persist (PersistField) import Database.Persist (PersistField)
import Text.HTML.SanitizeXSS (sanitizeXSS) import Text.HTML.SanitizeXSS (sanitizeBalance)
import Text.Blaze.Builder.Utf8 (writeChar) import Text.Blaze.Builder.Utf8 (writeChar)
import Text.Blaze.Builder.Core (writeList, writeByteString) import Text.Blaze.Builder.Core (writeList, writeByteString)
@ -74,7 +74,7 @@ timeFieldProfile = FieldProfile
htmlFieldProfile :: FieldProfile sub y Html htmlFieldProfile :: FieldProfile sub y Html
htmlFieldProfile = FieldProfile htmlFieldProfile = FieldProfile
{ fpParse = Right . preEscapedString . sanitizeXSS { fpParse = Right . preEscapedString . sanitizeBalance
, fpRender = lbsToChars . renderHtml , fpRender = lbsToChars . renderHtml
, fpWidget = \theId name val _isReq -> addHamlet [$hamlet| , fpWidget = \theId name val _isReq -> addHamlet [$hamlet|
%textarea.html#$theId$!name=$name$ $val$ %textarea.html#$theId$!name=$name$ $val$

View File

@ -19,6 +19,7 @@ module Yesod.Helpers.AtomFeed
( AtomFeed (..) ( AtomFeed (..)
, AtomFeedEntry (..) , AtomFeedEntry (..)
, atomFeed , atomFeed
, atomLink
, RepAtom (..) , RepAtom (..)
) where ) where
@ -69,3 +70,11 @@ entryTemplate arg = [$xhamlet|
%title $atomEntryTitle.arg$ %title $atomEntryTitle.arg$
%content!type=html $cdata.atomEntryContent.arg$ %content!type=html $cdata.atomEntryContent.arg$
|] |]
-- | Generates a link tag in the head of a widget.
atomLink :: Route m
-> String -- ^ title
-> GWidget s m ()
atomLink u title = addHamletHead [$hamlet|
%link!href=@u@!type="application/atom+xml"!rel="alternate"!title=$title$
|]

View File

@ -1,5 +1,5 @@
name: yesod name: yesod
version: 0.6.0.2 version: 0.6.1
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>
@ -44,7 +44,7 @@ library
, network >= 2.2.1.5 && < 2.3 , network >= 2.2.1.5 && < 2.3
, email-validate >= 0.2.5 && < 0.3 , email-validate >= 0.2.5 && < 0.3
, web-routes >= 0.23 && < 0.24 , web-routes >= 0.23 && < 0.24
, xss-sanitize >= 0.2 && < 0.3 , xss-sanitize >= 0.2.3 && < 0.3
, data-default >= 0.2 && < 0.3 , data-default >= 0.2 && < 0.3
, failure >= 0.1 && < 0.2 , failure >= 0.1 && < 0.2
, containers >= 0.2 && < 0.5 , containers >= 0.2 && < 0.5