packages feed

yesod-newsfeed 0.0.0.1 → 0.1.0

raw patch · 5 files changed

+29/−39 lines, 5 filesdep +textdep ~hamletdep ~yesod-core

Dependencies added: text

Dependency ranges changed: hamlet, yesod-core

Files

Yesod/Helpers/AtomFeed.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE CPP #-} ------------------------------------------------------------ |+-- -- Module        : Yesod.Helpers.AtomFeed -- Copyright     : Michael Snoyman -- License       : BSD3@@ -10,12 +10,11 @@ -- Stability     : Stable -- Portability   : portable ----- An Atom news feed.------ Atom spec: <http://en.wikipedia.org/wiki/Atom_(standard)>+-- Generating atom news feeds. -- --------------------------------------------------------- +-- | Generation of Atom newsfeeds. module Yesod.Helpers.AtomFeed     ( atomFeed     , atomLink@@ -31,12 +30,10 @@ import qualified Data.ByteString.Char8 as S8 import Control.Monad (liftM) --- | The Atom content type newtype RepAtom = RepAtom Content instance HasReps RepAtom where     chooseRep (RepAtom c) _ = return (typeAtom, c) --- | The feed response itself atomFeed :: Monad mo => Feed (Route master) -> GGHandler sub master mo RepAtom atomFeed = liftM RepAtom . hamletToContent . template 
Yesod/Helpers/Feed.hs view
@@ -1,5 +1,5 @@ ---------------------------------------------------------------------------------- |+-- -- Module        : Yesod.Helpers.Feed -- Copyright     : Patrick Brisbin -- License       : as-is@@ -8,8 +8,8 @@ -- Stability     : Stable -- Portability   : Portable ----- A generic feed that will reply with either Atom or Rss depending on --- what's requested.+-- Generic Feed and Feed Entry data types that can be used as either an+-- Rss feed or an Atom feed (or both, or other). -- -- Atom spec: <http://en.wikipedia.org/wiki/Atom_(standard)> -- Rss spec:  <http://www.rssboard.org/rss-specification>@@ -27,15 +27,12 @@ import Yesod.Content (HasReps (chooseRep), typeAtom, typeRss) import Yesod.Handler (Route, GGHandler) --- | The Rss\/Atom content type data RepAtomRss = RepAtomRss RepAtom RepRss instance HasReps RepAtomRss where     chooseRep (RepAtomRss (RepAtom a) (RepRss r)) = chooseRep         [ (typeAtom, a)         , (typeRss, r)         ]---- | The feed itself newsFeed :: Monad mo => Feed (Route master) -> GGHandler sub master mo RepAtomRss newsFeed f = do     a <- atomFeed f
Yesod/Helpers/FeedTypes.hs view
@@ -1,4 +1,3 @@--- | Base data types used in other modules module Yesod.Helpers.FeedTypes     ( Feed (..)     , FeedEntry (..)@@ -6,19 +5,21 @@  import Text.Hamlet      (Html) import Data.Time.Clock  (UTCTime)+import Data.Text        (Text) --- | The overall feed+-- | The overal feed data Feed url = Feed-    { feedTitle       :: String+    { feedTitle       :: Text     , feedLinkSelf    :: url     , feedLinkHome    :: url +     -- | note: currently only used for Rss     , feedDescription :: Html      -- | note: currently only used for Rss, possible values:      --   <http://www.rssboard.org/rss-language-codes>-    , feedLanguage    :: String+    , feedLanguage    :: Text      , feedUpdated     :: UTCTime     , feedEntries     :: [FeedEntry url]@@ -28,6 +29,6 @@ data FeedEntry url = FeedEntry     { feedEntryLink    :: url     , feedEntryUpdated :: UTCTime-    , feedEntryTitle   :: String+    , feedEntryTitle   :: Text     , feedEntryContent :: Html     }
Yesod/Helpers/RssFeed.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE CPP #-} ---------------------------------------------------------------------------------- |+-- -- Module        : Yesod.Helpers.RssFeed -- Copyright     : Patrick Brisbin -- License       : as-is@@ -10,10 +10,6 @@ -- Stability     : Stable -- Portability   : Portable ----- An Rss news feed.------ Rss spec:  <http://www.rssboard.org/rss-specification>--- ------------------------------------------------------------------------------- module Yesod.Helpers.RssFeed     ( rssFeed@@ -30,12 +26,11 @@ import qualified Data.ByteString.Char8 as S8 import Control.Monad (liftM) --- | The Rss content type newtype RepRss = RepRss Content instance HasReps RepRss where     chooseRep (RepRss c) _ = return (typeRss, c) --- | The feed response itself+-- | Generate the feed rssFeed :: Monad mo => Feed (Route master) -> GGHandler sub master mo RepRss rssFeed = liftM RepRss . hamletToContent . template @@ -46,15 +41,15 @@ #else     [$xhamlet| #endif-    \<?xml version="1.0" encoding="utf-8"?>+    \<?xml version="1.0" encoding="utf-8"?>      <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"         <channel             <atom:link href=@{feedLinkSelf arg} rel="self" type=#{S8.unpack typeRss}-            <title>#{feedTitle arg}-            <link>@{feedLinkHome arg}-            <description>#{feedDescription arg}+            <title>        #{feedTitle arg}+            <link>         @{feedLinkHome arg}+            <description>  #{feedDescription arg}             <lastBuildDate>#{formatRFC822 $ feedUpdated arg}-            <language>#{feedLanguage arg}+            <language>     #{feedLanguage arg}              $forall entry <- feedEntries arg                 ^{entryTemplate entry}@@ -68,10 +63,10 @@     [$xhamlet| #endif     <item-        <title>#{feedEntryTitle arg}-        <link>@{feedEntryLink arg}-        <guid>@{feedEntryLink arg}-        <pubDate>#{formatRFC822 $ feedEntryUpdated arg}+        <title>      #{feedEntryTitle arg}+        <link>       @{feedEntryLink arg}+        <guid>       @{feedEntryLink arg}+        <pubDate>    #{formatRFC822 $ feedEntryUpdated arg}         <description>#{feedEntryContent arg}     |] 
yesod-newsfeed.cabal view
@@ -1,11 +1,10 @@ name:            yesod-newsfeed-version:         0.0.0.1+version:         0.1.0 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman, Patrick Brisbin-maintainer:      Patrick Brisbin <pbrisbin@gmail.com>+maintainer:      Michael Snoyman <michael@snoyman.com> synopsis:        Helper functions and data types for producing News feeds.-Description:     Helper functions and data types for producing News feeds. category:        Web, Yesod stability:       Stable cabal-version:   >= 1.6@@ -14,10 +13,11 @@  library     build-depends:   base                      >= 4        && < 5-                   , yesod-core                >= 0.7      && < 0.8+                   , yesod-core                >= 0.8      && < 0.9                    , time                      >= 1.1.4    && < 1.3-                   , hamlet                    >= 0.7      && < 0.8+                   , hamlet                    >= 0.8      && < 0.9                    , bytestring                >= 0.9      && < 0.10+                   , text                      >= 0.9      && < 1.0     exposed-modules: Yesod.Helpers.AtomFeed                    , Yesod.Helpers.RssFeed                    , Yesod.Helpers.Feed@@ -26,4 +26,4 @@  source-repository head   type:     git-  location: git://github.com/pbrisbin/yesod-newsfeed.git+  location: git://github.com/snoyberg/yesod-newsfeed.git