yesod-text-markdown 0.1.7 → 0.1.8
raw patch · 2 files changed
+14/−8 lines, 2 filesdep ~aeson
Dependency ranges changed: aeson
Files
- Yesod/Text/Markdown.hs +12/−2
- yesod-text-markdown.cabal +2/−6
Yesod/Text/Markdown.hs view
@@ -1,9 +1,12 @@+-- | In addition to the exports here we also export these instances for 'Markdown':+--+-- 'PersistField', 'PersistFieldSql', 'ToJSON', 'FromJSON' {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}-module Yesod.Text.Markdown where+module Yesod.Text.Markdown (markdownField) where import Yesod.Core (RenderMessage) import Text.Hamlet (hamlet)@@ -17,7 +20,12 @@ import Database.Persist.Sql import Control.Applicative ((<$>)) import Control.Monad (mzero)-import Data.Aeson+import Data.Aeson (ToJSON(toJSON)+ , FromJSON(parseJSON)+ , (.=)+ , (.:)+ , object+ , Value(Object)) instance PersistField Markdown where toPersistValue (Markdown t) = PersistText $ toStrict t@@ -34,6 +42,8 @@ parseJSON (Object v) = Markdown <$> v .: "markdown" parseJSON _ = mzero +-- | Creates a @\<textarea>@ tag whose returned value is wrapped in a+-- 'Markdown' newtype; see 'Markdown' for details. markdownField :: (Monad m, RenderMessage (HandlerSite m) FormMessage) => Field m Markdown markdownField = Field { fieldParse = parseHelper $ Right . Markdown . fromStrict
yesod-text-markdown.cabal view
@@ -1,5 +1,5 @@ name: yesod-text-markdown-version: 0.1.7+version: 0.1.8 synopsis: Yesod support for Text.Markdown. description: Use Text.Markdown in a typical yesod project. This module contains instances related to persistence,@@ -16,10 +16,6 @@ This package intentionally tries to be like yesod-markdown, so switching between the markdown backends should be easy.- .- If you wonder why the haddocks only show a few exports,- it's because it doesn't show exporting of instances which- is most of what this package is about. bug-reports: https://github.com/Tarrasch/yesod-text-markdown/issues license: BSD3@@ -41,7 +37,7 @@ , persistent >= 1.2 && < 3.0 , text >= 0.11 && < 2.0 , shakespeare >= 2.0 && < 2.1- , aeson >= 0.7 && < 0.9+ , aeson >= 0.7 && < 1.0 ghc-options: -Wall -fno-warn-orphans source-repository head