snap-app 0.5.0 → 0.6.0
raw patch · 2 files changed
+9/−7 lines, 2 files
Files
- snap-app.cabal +1/−1
- src/Snap/App/RSS.hs +8/−6
snap-app.cabal view
@@ -1,5 +1,5 @@ name: snap-app-version: 0.5.0+version: 0.6.0 synopsis: Simple modules for writing apps with Snap, abstracted from hpaste. homepage: Simple modules for writing apps with Snap, abstracted from hpaste. license: BSD3
src/Snap/App/RSS.hs view
@@ -13,18 +13,20 @@ import Text.XML.Light -- | Output the given XML element.-outputRSS :: String -> String -> [(UTCTime,Text,Text)] -> Controller c s ()+outputRSS :: String -> String -> [(UTCTime,Text,Text,Text)] -> Controller c s () outputRSS title link = outputXML . makeFeed title link -- | Make a simple RSS feed.-makeFeed :: String -> String -> [(UTCTime,Text,Text)] -> Element+makeFeed :: String -> String -> [(UTCTime,Text,Text,Text)] -> Element makeFeed title link = xmlFeed . RSSFeed . makeRSS where makeRSS qs = (nullRSS title link) { rssChannel = makeChannel qs } makeChannel qs = (nullChannel title link) { rssItems = map makeItem qs }- makeItem (time,title,desc) = (nullItem (T.unpack title))- { rssItemPubDate = return (toPubDate time)- , rssItemDescription = return (T.unpack desc)- }+ makeItem (time,title,desc,link) =+ (nullItem (T.unpack title))+ { rssItemPubDate = return (toPubDate time)+ , rssItemDescription = return (T.unpack desc)+ , rssItemLink = return (T.unpack link)+ } toPubDate = formatTime defaultTimeLocale "%a, %d %b %Y %H:%M:%S UT"