packages feed

rss 3000.1.0 → 3000.2.0

raw patch · 4 files changed

+62/−41 lines, 4 filesdep +timedep −old-timedep ~HaXmldep ~basedep ~networksetup-changednew-uploader

Dependencies added: time

Dependencies removed: old-time

Dependency ranges changed: HaXml, base, network, old-locale

Files

+ README.markdown view
@@ -0,0 +1,3 @@+A Haskell library for generating RSS 2.0 feeds.++Note that this library was previously maintained by Bjorn Bringert in a [darcs repository](http://code.haskell.org/rss). It is currently maintained by Bas van Dijk in a [git repository](https://github.com/basvandijk/rss).
Setup.hs view
@@ -1,4 +1,4 @@-#!/usr/bin/env runghc+#!/usr/bin/env runhaskell  import Distribution.Simple main = defaultMain
Text/RSS.hs view
@@ -3,10 +3,10 @@ -- Module      :  Text.RSS -- Copyright   :  Copyright 2004, Jeremy Shaw, http://www.n-heptane.com/ --                Copyright 2004-2006, Bjorn Bringert (bjorn@bringert.net)--- License     :  This code is released to the public domain and comes +-- License     :  This code is released to the public domain and comes --                with no warranty. ----- Maintainer  :  Bjorn Bringert <bjorn@bringert.net>+-- Maintainer  :  Bas van Dijk <v.dijk.bas@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -23,33 +23,40 @@ -- -- * Use RFC 2822 format for dates. ----- * Added all elements from RSS 2.0.1-rv-6, +-- * Added all elements from RSS 2.0.1-rv-6, --   <http://www.rssboard.org/rss-2-0-1-rv-6> ----- * Use HaXml.Verbatim instead of HaXml.Pretty, since +-- * Use HaXml.Verbatim instead of HaXml.Pretty, since --   HaXml.Pretty seems to introduce spaces around entities. -- -- * Removed the use of content:encoded, since the description --   tag is the recommented way to include HTML content in RSS 2.0. --+-- Changes by Bas van Dijk:+--+-- * Use @UTCTime@ from @time@ instead of @CalendarTime@ from @old-time@.+--+-- * Add our own @Weekday@ type instead of using the @Day@ type from @old-time@.+-- ----------------------------------------------------------------------------- module Text.RSS (RSS(..), Item, ChannelElem(..), ItemElem(..),                  Title,Link,Description,Width,Height,                  Email,Domain,MIME_Type,InputName,-                 Hour, Minutes, -                 CloudHost, CloudPort, CloudPath, +                 Weekday(..), Hour, Minutes,+                 CloudHost, CloudPort, CloudPath,                  CloudProcedure, CloudProtocol(..),                  rssToXML, showXML                 ) where -import Data.List+import Data.Ix (Ix) -import Data.Maybe-import Network.URI+import Network.URI (URI) -import System.Locale-import System.Time+import System.Locale (defaultTimeLocale, rfc822DateFormat) +import Data.Time.Clock  (UTCTime)+import Data.Time.Format (formatTime)+ import Text.XML.HaXml.Combinators (CFilter, mkElem, mkElemAttr, literal, cdata) import Text.XML.HaXml.Escape      (xmlEscape, stdXmlEscaper) import Text.XML.HaXml.Types       (Element,Content(..))@@ -84,8 +91,8 @@                  | Copyright String                  | ManagingEditor Email                  | WebMaster Email-                 | ChannelPubDate CalendarTime-                 | LastBuildDate CalendarTime+                 | ChannelPubDate UTCTime+                 | LastBuildDate UTCTime                  | ChannelCategory (Maybe Domain) String                  | Generator String                  -- no docs tag, we generate that automatically@@ -95,7 +102,7 @@                  | Rating String                  | TextInput Title Description InputName Link                  | SkipHours [Hour]-                 | SkipDays [Day]+                 | SkipDays [Weekday] 		   deriving Show  data ItemElem = Title Title@@ -106,15 +113,20 @@               | Comments URI 	      | Enclosure URI Int MIME_Type 	      | Guid Bool String-	      | PubDate CalendarTime+	      | PubDate UTCTime 	      | Source URI Title-		deriving Show+		deriving (Show) --- | Converts RSS to XML. +-- | A day of the week.+data Weekday = Sunday   | Monday | Tuesday | Wednesday+             | Thursday | Friday | Saturday+               deriving (Eq, Ord, Enum, Bounded, Ix, Read, Show)++-- | Converts RSS to XML. rssToXML :: RSS -> CFilter ()-rssToXML (RSS title link description celems items) = +rssToXML (RSS title link description celems items) =     mkElemAttr "rss" [("version",literal "2.0")]-                     [mkElem "channel" ([mkTitle title, +                     [mkElem "channel" ([mkTitle title,                                          mkLink link, 				         mkDescription description,                                          mkDocs]@@ -138,7 +150,7 @@ mkTitle = mkSimple "title"  mkLink :: Link -> CFilter ()-mkLink = mkSimple "link" . show +mkLink = mkSimple "link" . show  mkDescription :: Description -> CFilter () mkDescription str = mkElem "description" [cdata str]@@ -146,14 +158,14 @@ mkDocs :: CFilter () mkDocs = mkSimple "docs" "http://www.rssboard.org/rss-specification" -mkPubDate :: CalendarTime -> CFilter ()+mkPubDate :: UTCTime -> CFilter () mkPubDate = mkSimple "pubDate" . formatDate -formatDate :: CalendarTime -> String-formatDate = formatCalendarTime defaultTimeLocale rfc822DateFormat+formatDate :: UTCTime -> String+formatDate = formatTime defaultTimeLocale rfc822DateFormat  mkCategory :: Maybe Domain -> String -> CFilter ()-mkCategory md s = mkElemAttr "category" attrs [literal s] +mkCategory md s = mkElemAttr "category" attrs [literal s]     where attrs = maybe [] (\d -> [("domain", literal d)]) md  maybeElem :: (a -> CFilter ()) -> Maybe a -> [CFilter ()]@@ -174,10 +186,10 @@                                     ("path", literal path),                                     ("registerProcedure", literal proc),                                     ("protocol", literal (protocolName proto))] []-mkChannelElem (TTL min) = mkSimple "ttl" $ show min+mkChannelElem (TTL minutes) = mkSimple "ttl" $ show minutes mkChannelElem (Image uri title link mw mh mdesc)               = mkElem "image" ([mkElem "url" [literal (show uri)],-                                mkTitle title, mkLink link] +                                mkTitle title, mkLink link]                                 ++ maybeElem (mkSimple "width" . show) mw                                 ++ maybeElem (mkSimple "height" . show) mh                                 ++ maybeElem mkDescription mdesc)@@ -202,13 +214,13 @@ mkItemElem (Author e) = mkElem "author" [literal e] mkItemElem (Category md str) = mkCategory md str mkItemElem (Comments uri) = mkSimple "comments" $ show uri-mkItemElem (Enclosure uri length mtype) = +mkItemElem (Enclosure uri len mtype) =     mkElemAttr "enclosure" [("url", literal (show uri)),-                            ("length", literal (show length)),-			    ("type", literal (mtype))] +                            ("length", literal (show len)),+			    ("type", literal (mtype))]                            [] mkItemElem (Guid perm s) = mkElemAttr "guid" attrs [ literal s ]     where attrs = if perm then [("isPermaLink", literal "true")] else [] mkItemElem (PubDate ct) = mkElem "pubDate" [ literal (formatDate ct) ]-mkItemElem (Source uri t) = +mkItemElem (Source uri t) =     mkElemAttr "source" [("url", literal (show uri))] [ literal t ]
rss.cabal view
@@ -1,22 +1,28 @@ Name: rss-Version: 3000.1.0-Cabal-version: >=1.2+Version: 3000.2.0+Cabal-version: >=1.6 Build-type: Simple Copyright: Jeremy Shaw 2004, Bjorn Bringert 2004-2006-Maintainer: bjorn@bringert.net+Maintainer: Bas van Dijk <v.dijk.bas@gmail.com> Author: Jeremy Shaw, Bjorn Bringert License: PublicDomain+Homepage:    https://github.com/basvandijk/rss+Bug-reports: https://github.com/basvandijk/rss/issues Synopsis: A library for generating RSS 2.0 feeds. Description:  This library allows you to generate RSS 2.0 feeds. -Flag split-base+extra-source-files: README.markdown +source-repository head+  Type:     git+  Location: git://github.com/basvandijk/rss.git+ Library-  build-depends: base, network, HaXml >= 1.19.2 && < 1.20-  if flag(split-base)-    Build-depends: base >= 3.0, old-time, old-locale-  else-    Build-depends: base < 3.0+  build-depends: base       >= 3      && < 5+               , network    >= 2.0    && < 2.4+               , HaXml      >= 1.19.2 && < 1.23+               , time       >= 1.1.2  && < 1.5+               , old-locale >= 1.0    && < 1.1   Exposed-Modules: Text.RSS-  ghc-options: -W -fwarn-incomplete-patterns+  ghc-options: -Wall