Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-feed for openSUSE:Factory checked in at 2021-03-17 20:15:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-feed (Old) and /work/SRC/openSUSE:Factory/.ghc-feed.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-feed" Wed Mar 17 20:15:30 2021 rev:5 rq:879158 version:1.3.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-feed/ghc-feed.changes 2020-12-22 11:39:19.965492615 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-feed.new.2401/ghc-feed.changes 2021-03-17 20:19:33.443284917 +0100 @@ -1,0 +2,7 @@ +Thu Mar 11 08:23:38 UTC 2021 - psim...@suse.com + +- Update feed to version 1.3.2.0. + ### 1.3.2.0 + * Expose RSS/Atom item content through queries by using `getItemContent`. + +------------------------------------------------------------------- Old: ---- feed-1.3.0.1.tar.gz feed.cabal New: ---- feed-1.3.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-feed.spec ++++++ --- /var/tmp/diff_new_pack.I4l2GH/_old 2021-03-17 20:19:33.887285524 +0100 +++ /var/tmp/diff_new_pack.I4l2GH/_new 2021-03-17 20:19:33.887285524 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-feed # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,13 +19,12 @@ %global pkg_name feed %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.3.0.1 +Version: 1.3.2.0 Release: 0 Summary: Interfacing with RSS (v 0.9x, 2.x, 1.0) + Atom feeds License: BSD-3-Clause URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-base-compat-devel BuildRequires: ghc-bytestring-devel @@ -42,6 +41,8 @@ ExcludeArch: %{ix86} %if %{with tests} BuildRequires: ghc-HUnit-devel +BuildRequires: ghc-doctest-devel +BuildRequires: ghc-doctest-driver-gen-devel BuildRequires: ghc-syb-devel BuildRequires: ghc-test-framework-devel BuildRequires: ghc-test-framework-hunit-devel @@ -72,7 +73,6 @@ %prep %autosetup -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ feed-1.3.0.1.tar.gz -> feed-1.3.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/CHANGELOG.md new/feed-1.3.2.0/CHANGELOG.md --- old/feed-1.3.0.1/CHANGELOG.md 2020-03-20 21:16:33.000000000 +0100 +++ new/feed-1.3.2.0/CHANGELOG.md 2021-03-10 07:17:26.000000000 +0100 @@ -1,3 +1,6 @@ +### 1.3.2.0 +* Expose RSS/Atom item content through queries by using `getItemContent`. + ### 1.3.0.1 * Add a test to check that validation works on a simple entry. * Change attribute handling when validating so that type attribute is recognised properly on content. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/README.lhs new/feed-1.3.2.0/README.lhs --- old/feed-1.3.0.1/README.lhs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/README.lhs 2021-03-10 07:17:26.000000000 +0100 @@ -8,11 +8,12 @@ Interfacing with *RSS* (v 0.9x, 2.x, 1.0) + *Atom* feeds. - Parsers -- Pretty Printers +- Constructors +- Rendering - Querying To help working with the multiple feed formats we've ended up with -this set of modules providing parsers, pretty printers and some utility +this set of modules providing parsers, printers and some utility code for querying and just generally working with a concrete representation of feeds in Haskell. @@ -37,35 +38,50 @@ module Main where import Prelude.Compat hiding (take) - +import Data.Maybe import Data.Text import Data.XML.Types as XML import qualified Data.Text.Lazy as Lazy +import Text.Feed.Types + +import Text.XML (def, rsPretty) import qualified Text.Atom.Feed as Atom -import qualified Text.Atom.Feed.Export as Export (textFeed) +import qualified Text.Feed.Export as Export (textFeedWith) myFeed :: Atom.Feed myFeed = Atom.nullFeed - "http://example.com/atom.xml" -- ^ id - (Atom.TextString "Example Website") -- ^ title - "2017-08-01" -- ^ last updated + "http://example.com/atom.xml" + (Atom.TextString "Example Website") + "2017-08-01" ``` Now we can export the feed to `Text`. ```haskell -renderFeed :: Atom.Feed -> Maybe Lazy.Text -renderFeed = Export.textFeed +renderFeed :: Atom.Feed -> Lazy.Text +renderFeed = fromJust . Export.textFeedWith def{rsPretty = True} . AtomFeed ``` -``` -> renderFeed myFeed -<?xml version="1.0" encoding="UTF-8"?> -<feed xmlns="http://www.w3.org/2005/Atom"> - <title type="text">Example Website</title> - <id>http://example.com/atom.xml</id> - <updated>2017-08-01</updated> -</feed> +We can now render our feed: + +```haskell +-- | +-- $setup +-- >>> import qualified Data.Text.Lazy.IO as Lazy +-- +-- >>> Lazy.putStr $ renderFeed myFeed +-- <?xml version="1.0" encoding="UTF-8"?> +-- <feed xmlns="http://www.w3.org/2005/Atom"> +-- <title type="text"> +-- Example Website +-- </title> +-- <id> +-- http://example.com/atom.xml +-- </id> +-- <updated> +-- 2017-08-01 +-- </updated> +-- </feed> ``` The `TextContent` sum type allows us to specify which type of text we're providing. @@ -120,36 +136,64 @@ } ``` +```haskell +-- | +-- >>> Lazy.putStr $ renderFeed feed +-- <?xml version="1.0" encoding="UTF-8"?> +-- <feed xmlns="http://www.w3.org/2005/Atom"> +-- <title type="text"> +-- Example Website +-- </title> +-- <id> +-- http://example.com/atom.xml +-- </id> +-- <updated> +-- 2017-08-01 +-- </updated> +-- <link href="http://example.com/"/> +-- <entry> +-- <id> +-- http://example.com/2 +-- </id> +-- <title type="text"> +-- Bar. +-- </title> +-- <updated> +-- 2000-02-02T18:30:00Z +-- </updated> +-- <author> +-- <name> +-- J. Smith +-- </name> +-- </author> +-- <content type="html"> +-- Bar. +-- </content> +-- <link href="http://example.com/2"/> +-- </entry> +-- <entry> +-- <id> +-- http://example.com/1 +-- </id> +-- <title type="text"> +-- Foo. +-- </title> +-- <updated> +-- 2000-01-01T18:30:00Z +-- </updated> +-- <author> +-- <name> +-- J. Smith +-- </name> +-- </author> +-- <content type="html"> +-- Foo. +-- </content> +-- <link href="http://example.com/1"/> +-- </entry> +-- </feed> ``` -> renderFeed feed -<?xml version="1.0" encoding="UTF-8"?> -<feed xmlns="http://www.w3.org/2005/Atom"> - <title type="text">Example Website</title> - <id>http://example.com/atom.xml</id> - <updated>2017-08-01</updated> - <link href="http://example.com/"/> - <entry> - <id>http://example.com/2</id> - <title type="text">Bar.</title> - <updated>2000-02-02T18:30:00Z</updated> - <author> - <name>J. Smith</name> - </author> - <content type="text">Bar.</content> - <link href="http://example.com/2"/> - </entry> - <entry> - <id>http://example.com/1</id> - <title type="text">Foo.</title> - <updated>2000-01-01T18:30:00Z</updated> - <author> - <name>J. Smith</name> - </author> - <content type="text">Foo.</content> - <link href="http://example.com/1"/> - </entry> -</feed> -``` + See [here](https://github.com/bergmark/feed/blob/master/tests/Example/CreateAtom.hs) for this content as an uninterrupted running example. ```haskell diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/README.md new/feed-1.3.2.0/README.md --- old/feed-1.3.0.1/README.md 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/README.md 2021-03-10 07:17:26.000000000 +0100 @@ -8,11 +8,12 @@ Interfacing with *RSS* (v 0.9x, 2.x, 1.0) + *Atom* feeds. - Parsers -- Pretty Printers +- Constructors +- Rendering - Querying To help working with the multiple feed formats we've ended up with -this set of modules providing parsers, pretty printers and some utility +this set of modules providing parsers, printers and some utility code for querying and just generally working with a concrete representation of feeds in Haskell. @@ -37,35 +38,50 @@ module Main where import Prelude.Compat hiding (take) - +import Data.Maybe import Data.Text import Data.XML.Types as XML import qualified Data.Text.Lazy as Lazy +import Text.Feed.Types + +import Text.XML (def, rsPretty) import qualified Text.Atom.Feed as Atom -import qualified Text.Atom.Feed.Export as Export (textFeed) +import qualified Text.Feed.Export as Export (textFeedWith) myFeed :: Atom.Feed myFeed = Atom.nullFeed - "http://example.com/atom.xml" -- ^ id - (Atom.TextString "Example Website") -- ^ title - "2017-08-01" -- ^ last updated + "http://example.com/atom.xml" + (Atom.TextString "Example Website") + "2017-08-01" ``` Now we can export the feed to `Text`. ```haskell -renderFeed :: Atom.Feed -> Maybe Lazy.Text -renderFeed = Export.textFeed +renderFeed :: Atom.Feed -> Lazy.Text +renderFeed = fromJust . Export.textFeedWith def{rsPretty = True} . AtomFeed ``` -``` -> renderFeed myFeed -<?xml version="1.0" encoding="UTF-8"?> -<feed xmlns="http://www.w3.org/2005/Atom"> - <title type="text">Example Website</title> - <id>http://example.com/atom.xml</id> - <updated>2017-08-01</updated> -</feed> +We can now render our feed: + +```haskell +-- | +-- $setup +-- >>> import qualified Data.Text.Lazy.IO as Lazy +-- +-- >>> Lazy.putStr $ renderFeed myFeed +-- <?xml version="1.0" encoding="UTF-8"?> +-- <feed xmlns="http://www.w3.org/2005/Atom"> +-- <title type="text"> +-- Example Website +-- </title> +-- <id> +-- http://example.com/atom.xml +-- </id> +-- <updated> +-- 2017-08-01 +-- </updated> +-- </feed> ``` The `TextContent` sum type allows us to specify which type of text we're providing. @@ -120,36 +136,64 @@ } ``` +```haskell +-- | +-- >>> Lazy.putStr $ renderFeed feed +-- <?xml version="1.0" encoding="UTF-8"?> +-- <feed xmlns="http://www.w3.org/2005/Atom"> +-- <title type="text"> +-- Example Website +-- </title> +-- <id> +-- http://example.com/atom.xml +-- </id> +-- <updated> +-- 2017-08-01 +-- </updated> +-- <link href="http://example.com/"/> +-- <entry> +-- <id> +-- http://example.com/2 +-- </id> +-- <title type="text"> +-- Bar. +-- </title> +-- <updated> +-- 2000-02-02T18:30:00Z +-- </updated> +-- <author> +-- <name> +-- J. Smith +-- </name> +-- </author> +-- <content type="html"> +-- Bar. +-- </content> +-- <link href="http://example.com/2"/> +-- </entry> +-- <entry> +-- <id> +-- http://example.com/1 +-- </id> +-- <title type="text"> +-- Foo. +-- </title> +-- <updated> +-- 2000-01-01T18:30:00Z +-- </updated> +-- <author> +-- <name> +-- J. Smith +-- </name> +-- </author> +-- <content type="html"> +-- Foo. +-- </content> +-- <link href="http://example.com/1"/> +-- </entry> +-- </feed> ``` -> renderFeed feed -<?xml version="1.0" encoding="UTF-8"?> -<feed xmlns="http://www.w3.org/2005/Atom"> - <title type="text">Example Website</title> - <id>http://example.com/atom.xml</id> - <updated>2017-08-01</updated> - <link href="http://example.com/"/> - <entry> - <id>http://example.com/2</id> - <title type="text">Bar.</title> - <updated>2000-02-02T18:30:00Z</updated> - <author> - <name>J. Smith</name> - </author> - <content type="text">Bar.</content> - <link href="http://example.com/2"/> - </entry> - <entry> - <id>http://example.com/1</id> - <title type="text">Foo.</title> - <updated>2000-01-01T18:30:00Z</updated> - <author> - <name>J. Smith</name> - </author> - <content type="text">Foo.</content> - <link href="http://example.com/1"/> - </entry> -</feed> -``` + See [here](https://github.com/bergmark/feed/blob/master/tests/Example/CreateAtom.hs) for this content as an uninterrupted running example. ```haskell diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/feed.cabal new/feed-1.3.2.0/feed.cabal --- old/feed-1.3.0.1/feed.cabal 2020-03-20 21:16:48.000000000 +0100 +++ new/feed-1.3.2.0/feed.cabal 2021-03-11 05:47:51.000000000 +0100 @@ -1,5 +1,5 @@ name: feed -version: 1.3.0.1 +version: 1.3.2.0 license: BSD3 license-file: LICENSE category: Text @@ -21,11 +21,10 @@ maintainer: Adam Bergmark <a...@bergmark.nl> homepage: https://github.com/bergmark/feed bug-reports: https://github.com/bergmark/feed/issues -cabal-version: >= 1.8 +cabal-version: 2.0 build-type: Simple tested-with: - GHC == 7.4.2 - , GHC == 7.6.3 + GHC == 7.6.3 , GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2 @@ -33,6 +32,7 @@ , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.1 + , GHC == 8.10.1 data-files: tests/files/*.xml extra-source-files: @@ -46,7 +46,8 @@ library ghc-options: -Wall hs-source-dirs: src - extensions: + default-language: Haskell2010 + default-extensions: NoImplicitPrelude OverloadedStrings exposed-modules: @@ -76,7 +77,7 @@ Data.Text.Util Data.XML.Compat build-depends: - base >= 4 && < 4.14 + base >= 4 && < 4.15 , base-compat >= 0.9 && < 0.12 , bytestring >= 0.9 && < 0.11 , old-locale == 1.0.* @@ -94,9 +95,12 @@ hs-source-dirs: tests main-is: Main.hs type: exitcode-stdio-1.0 - extensions: + default-language: Haskell2010 + default-extensions: NoImplicitPrelude OverloadedStrings + autogen-modules: + Paths_feed other-modules: Paths_feed Example @@ -111,7 +115,7 @@ Text.RSS.Tests Text.RSS.Utils build-depends: - base >= 4 && < 4.14 + base >= 4.6 && < 4.15 , base-compat >= 0.9 && < 0.12 , HUnit >= 1.2 && < 1.7 , feed @@ -127,17 +131,31 @@ test-suite readme ghc-options: -Wall -pgmL markdown-unlit main-is: README.lhs - extensions: + default-language: Haskell2010 + default-extensions: NoImplicitPrelude OverloadedStrings type: exitcode-stdio-1.0 build-depends: - base >= 4 && < 4.14 + base >= 4.6 && < 4.15 , base-compat >= 0.9 && < 0.12 , text - , xml-types , feed , xml-conduit , xml-types build-tool-depends: markdown-unlit:markdown-unlit >= 0.4 && < 0.6 + +test-suite readme-doctests + hs-source-dirs: tests + main-is: doctest-driver.hs + type: exitcode-stdio-1.0 + default-language: Haskell2010 + build-depends: + base >= 4 && < 4.15 + , doctest + , doctest-driver-gen + , feed + build-tool-depends: + markdown-unlit:markdown-unlit >= 0.4 && < 0.6 + , doctest-driver-gen:doctest-driver-gen diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Data/Text/Util.hs new/feed-1.3.2.0/src/Data/Text/Util.hs --- old/feed-1.3.0.1/src/Data/Text/Util.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Data/Text/Util.hs 2021-03-10 07:17:26.000000000 +0100 @@ -1,6 +1,7 @@ module Data.Text.Util ( readInt , renderFeed + , renderFeedWith ) where import Prelude.Compat @@ -8,9 +9,9 @@ import Data.Text import Data.Text.Read +import qualified Data.Text.Lazy as TL import qualified Data.XML.Types as XT -- from xml-types import qualified Text.XML as XC -- from xml-conduit -import qualified Data.Text.Lazy as TL readInt :: Text -> Maybe Integer readInt s = @@ -19,14 +20,17 @@ _ -> Nothing renderFeed :: (a -> XT.Element) -> a -> Maybe TL.Text -renderFeed cf f = let e = cf f - d = elToDoc e - in XC.renderText XC.def <$> d +renderFeed = renderFeedWith XC.def +renderFeedWith :: XC.RenderSettings -> (a -> XT.Element) -> a -> Maybe TL.Text +renderFeedWith opts cf f = + let e = cf f + d = elToDoc e + in XC.renderText opts <$> d -- Ancillaries -- - elToDoc :: XT.Element -> Maybe XC.Document -elToDoc el = let txd = XT.Document (XC.Prologue [] Nothing []) el [] - cxd = XC.fromXMLDocument txd - in either (const Nothing) Just cxd +elToDoc el = + let txd = XT.Document (XC.Prologue [] Nothing []) el [] + cxd = XC.fromXMLDocument txd + in either (const Nothing) Just cxd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/Atom/Feed/Export.hs new/feed-1.3.2.0/src/Text/Atom/Feed/Export.hs --- old/feed-1.3.0.1/src/Text/Atom/Feed/Export.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/Atom/Feed/Export.hs 2021-03-10 07:17:26.000000000 +0100 @@ -57,10 +57,10 @@ import Prelude.Compat import Data.Text (Text, pack) -import Data.XML.Types as XML -import Text.Atom.Feed import qualified Data.Text.Lazy as TL import qualified Data.Text.Util as U +import Data.XML.Types as XML +import Text.Atom.Feed atom_prefix :: Maybe Text atom_prefix = Nothing -- Just "atom" @@ -107,7 +107,8 @@ atomName nc = Name {nameLocalName = nc, nameNamespace = Just atomNS, namePrefix = atom_prefix} atomAttr :: Text -> Text -> Attr -atomAttr x y = (Name {nameLocalName = x, nameNamespace = Nothing, namePrefix = atom_prefix}, [ContentText y]) +atomAttr x y = + (Name {nameLocalName = x, nameNamespace = Nothing, namePrefix = atom_prefix}, [ContentText y]) atomNode :: Text -> [Node] -> XML.Element atomNode x = blank_element (atomName x) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/Atom/Feed/Validate.hs new/feed-1.3.2.0/src/Text/Atom/Feed/Validate.hs --- old/feed-1.3.0.1/src/Text/Atom/Feed/Validate.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/Atom/Feed/Validate.hs 2021-03-10 07:17:26.000000000 +0100 @@ -53,8 +53,7 @@ import Data.Maybe data VTree a - = VNode [a] - [VTree a] + = VNode [a] [VTree a] | VLeaf [a] deriving (Eq, Show) @@ -149,8 +148,7 @@ case pNodes "link" (elementChildren e) of xs -> case map fst $ - filter (\(_, n) -> n == "alternate") $ - mapMaybe (\ex -> (ex,) <$> pAttr "rel" ex) xs of + filter (\(_, n) -> n == "alternate") $ mapMaybe (\ex -> (ex, ) <$> pAttr "rel" ex) xs of xs1 -> let jmb (Just x) (Just y) = Just (x, y) jmb _ _ = Nothing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/Atom/Feed.hs new/feed-1.3.2.0/src/Text/Atom/Feed.hs --- old/feed-1.3.0.1/src/Text/Atom/Feed.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/Atom/Feed.hs 2021-03-10 07:17:26.000000000 +0100 @@ -54,77 +54,85 @@ type MediaType = Text -data Feed = Feed - { feedId :: URI - , feedTitle :: TextContent - , feedUpdated :: Date - , feedAuthors :: [Person] - , feedCategories :: [Category] - , feedContributors :: [Person] - , feedGenerator :: Maybe Generator - , feedIcon :: Maybe URI - , feedLinks :: [Link] - , feedLogo :: Maybe URI - , feedRights :: Maybe TextContent - , feedSubtitle :: Maybe TextContent - , feedEntries :: [Entry] - , feedAttrs :: [Attr] - , feedOther :: [XML.Element] - } deriving (Show) - -data Entry = Entry - { entryId :: URI - , entryTitle :: TextContent - , entryUpdated :: Date - , entryAuthors :: [Person] - , entryCategories :: [Category] - , entryContent :: Maybe EntryContent - , entryContributor :: [Person] - , entryLinks :: [Link] - , entryPublished :: Maybe Date - , entryRights :: Maybe TextContent - , entrySource :: Maybe Source - , entrySummary :: Maybe TextContent - , entryInReplyTo :: Maybe InReplyTo - , entryInReplyTotal :: Maybe InReplyTotal - , entryAttrs :: [Attr] - , entryOther :: [XML.Element] - } deriving (Show) +data Feed = + Feed + { feedId :: URI + , feedTitle :: TextContent + , feedUpdated :: Date + , feedAuthors :: [Person] + , feedCategories :: [Category] + , feedContributors :: [Person] + , feedGenerator :: Maybe Generator + , feedIcon :: Maybe URI + , feedLinks :: [Link] + , feedLogo :: Maybe URI + , feedRights :: Maybe TextContent + , feedSubtitle :: Maybe TextContent + , feedEntries :: [Entry] + , feedAttrs :: [Attr] + , feedOther :: [XML.Element] + } + deriving (Show) + +data Entry = + Entry + { entryId :: URI + , entryTitle :: TextContent + , entryUpdated :: Date + , entryAuthors :: [Person] + , entryCategories :: [Category] + , entryContent :: Maybe EntryContent + , entryContributor :: [Person] + , entryLinks :: [Link] + , entryPublished :: Maybe Date + , entryRights :: Maybe TextContent + , entrySource :: Maybe Source + , entrySummary :: Maybe TextContent + , entryInReplyTo :: Maybe InReplyTo + , entryInReplyTotal :: Maybe InReplyTotal + , entryAttrs :: [Attr] + , entryOther :: [XML.Element] + } + deriving (Show) data EntryContent = TextContent Text | HTMLContent Text | XHTMLContent XML.Element - | MixedContent (Maybe Text) - [XML.Node] - | ExternalContent (Maybe MediaType) - URI - deriving (Show) - -data Category = Category - { catTerm :: Text -- ^ the tag\/term of the category. - , catScheme :: Maybe URI -- ^ optional URL for identifying the categorization scheme. - , catLabel :: Maybe Text -- ^ human-readable label of the category - , catOther :: [XML.Element] -- ^ unknown elements, for extensibility. - } deriving (Show) - -data Generator = Generator - { genURI :: Maybe URI - , genVersion :: Maybe Text - , genText :: Text - } deriving (Eq, Show) + | MixedContent (Maybe Text) [XML.Node] + | ExternalContent (Maybe MediaType) URI + deriving (Show) -data Link = Link - { linkHref :: URI +data Category = + Category + { catTerm :: Text -- ^ the tag\/term of the category. + , catScheme :: Maybe URI -- ^ optional URL for identifying the categorization scheme. + , catLabel :: Maybe Text -- ^ human-readable label of the category + , catOther :: [XML.Element] -- ^ unknown elements, for extensibility. + } + deriving (Show) + +data Generator = + Generator + { genURI :: Maybe URI + , genVersion :: Maybe Text + , genText :: Text + } + deriving (Eq, Show) + +data Link = + Link + { linkHref :: URI -- ToDo: make the switch over to using the Atom.Feed.Link relation type. - , linkRel :: Maybe (Either NCName URI) - , linkType :: Maybe MediaType - , linkHrefLang :: Maybe Text - , linkTitle :: Maybe Text - , linkLength :: Maybe Text - , linkAttrs :: [Attr] - , linkOther :: [XML.Element] - } deriving (Show) + , linkRel :: Maybe (Either NCName URI) + , linkType :: Maybe MediaType + , linkHrefLang :: Maybe Text + , linkTitle :: Maybe Text + , linkLength :: Maybe Text + , linkAttrs :: [Attr] + , linkOther :: [XML.Element] + } + deriving (Show) data TextContent = TextString Text @@ -137,41 +145,49 @@ txtToString (HTMLString s) = unpack s txtToString (XHTMLString x) = show x -data Source = Source - { sourceAuthors :: [Person] - , sourceCategories :: [Category] - , sourceGenerator :: Maybe Generator - , sourceIcon :: Maybe URI - , sourceId :: Maybe URI - , sourceLinks :: [Link] - , sourceLogo :: Maybe URI - , sourceRights :: Maybe TextContent - , sourceSubtitle :: Maybe TextContent - , sourceTitle :: Maybe TextContent - , sourceUpdated :: Maybe Date - , sourceOther :: [XML.Element] - } deriving (Show) - -data Person = Person - { personName :: Text - , personURI :: Maybe URI - , personEmail :: Maybe Text - , personOther :: [XML.Element] - } deriving (Show) - -data InReplyTo = InReplyTo - { replyToRef :: URI - , replyToHRef :: Maybe URI - , replyToType :: Maybe MediaType - , replyToSource :: Maybe URI - , replyToOther :: [Attr] - , replyToContent :: [Node] - } deriving (Show) - -data InReplyTotal = InReplyTotal - { replyToTotal :: Integer -- non-negative :) - , replyToTotalOther :: [Attr] - } deriving (Show) +data Source = + Source + { sourceAuthors :: [Person] + , sourceCategories :: [Category] + , sourceGenerator :: Maybe Generator + , sourceIcon :: Maybe URI + , sourceId :: Maybe URI + , sourceLinks :: [Link] + , sourceLogo :: Maybe URI + , sourceRights :: Maybe TextContent + , sourceSubtitle :: Maybe TextContent + , sourceTitle :: Maybe TextContent + , sourceUpdated :: Maybe Date + , sourceOther :: [XML.Element] + } + deriving (Show) + +data Person = + Person + { personName :: Text + , personURI :: Maybe URI + , personEmail :: Maybe Text + , personOther :: [XML.Element] + } + deriving (Show) + +data InReplyTo = + InReplyTo + { replyToRef :: URI + , replyToHRef :: Maybe URI + , replyToType :: Maybe MediaType + , replyToSource :: Maybe URI + , replyToOther :: [Attr] + , replyToContent :: [Node] + } + deriving (Show) + +data InReplyTotal = + InReplyTotal + { replyToTotal :: Integer -- non-negative :) + , replyToTotalOther :: [Attr] + } + deriving (Show) -- *Smart Constructors newCategory :: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/Atom/Pub.hs new/feed-1.3.2.0/src/Text/Atom/Pub.hs --- old/feed-1.3.0.1/src/Text/Atom/Pub.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/Atom/Pub.hs 2021-03-10 07:17:26.000000000 +0100 @@ -26,32 +26,34 @@ import Data.XML.Types as XML import Text.Atom.Feed (Category, TextContent, URI) -data Service = Service - { serviceWorkspaces :: [Workspace] - , serviceOther :: [XML.Element] - } +data Service = + Service + { serviceWorkspaces :: [Workspace] + , serviceOther :: [XML.Element] + } -data Workspace = Workspace - { workspaceTitle :: TextContent - , workspaceCols :: [Collection] - , workspaceOther :: [XML.Element] - } +data Workspace = + Workspace + { workspaceTitle :: TextContent + , workspaceCols :: [Collection] + , workspaceOther :: [XML.Element] + } -data Collection = Collection - { collectionURI :: URI - , collectionTitle :: TextContent - , collectionAccept :: [Accept] - , collectionCats :: [Categories] - , collectionOther :: [XML.Element] - } +data Collection = + Collection + { collectionURI :: URI + , collectionTitle :: TextContent + , collectionAccept :: [Accept] + , collectionCats :: [Categories] + , collectionOther :: [XML.Element] + } data Categories = CategoriesExternal URI - | Categories (Maybe Bool) - (Maybe URI) - [Category] + | Categories (Maybe Bool) (Maybe URI) [Category] deriving (Show) -newtype Accept = Accept - { acceptType :: Text - } +newtype Accept = + Accept + { acceptType :: Text + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/DublinCore/Types.hs new/feed-1.3.2.0/src/Text/DublinCore/Types.hs --- old/feed-1.3.0.1/src/Text/DublinCore/Types.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/DublinCore/Types.hs 2021-03-10 07:17:26.000000000 +0100 @@ -24,10 +24,12 @@ import Data.Text -- | A DCItem pairs a specific element with its (string) value. -data DCItem = DCItem - { dcElt :: DCInfo - , dcText :: Text - } deriving (Eq, Show) +data DCItem = + DCItem + { dcElt :: DCInfo + , dcText :: Text + } + deriving (Eq, Show) -- | The Dublin Core Metadata Element Set, all 15 of them (plus an extension constructor.) data DCInfo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/Feed/Export.hs new/feed-1.3.2.0/src/Text/Feed/Export.hs --- old/feed-1.3.0.1/src/Text/Feed/Export.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/Feed/Export.hs 2021-03-10 07:17:26.000000000 +0100 @@ -14,19 +14,21 @@ module Text.Feed.Export ( Text.Feed.Export.xmlFeed -- :: Feed -> XML.Element , Text.Feed.Export.textFeed -- :: Feed -> TL.Text + , Text.Feed.Export.textFeedWith ) where import Prelude.Compat import Text.Feed.Types +import qualified Data.Text.Util as U import Text.Atom.Feed.Export as Atom import Text.RSS.Export as RSS import Text.RSS1.Export as RSS1 -import qualified Data.Text.Util as U -import Data.XML.Types as XML import qualified Data.Text.Lazy as TL +import Data.XML.Types as XML +import Text.XML (RenderSettings) -- | 'xmlFeed f' serializes a @Feed@ document into a conforming -- XML toplevel element. @@ -40,3 +42,6 @@ textFeed :: Feed -> Maybe TL.Text textFeed = U.renderFeed Text.Feed.Export.xmlFeed + +textFeedWith :: RenderSettings -> Feed -> Maybe TL.Text +textFeedWith settings = U.renderFeedWith settings Text.Feed.Export.xmlFeed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/Feed/Import.hs new/feed-1.3.2.0/src/Text/Feed/Import.hs --- old/feed-1.3.0.1/src/Text/Feed/Import.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/Feed/Import.hs 2021-03-10 07:17:26.000000000 +0100 @@ -69,7 +69,7 @@ -- | 'parseFeedFromFile fp' reads in the contents of the file at @fp@; -- the assumed encoding is UTF-8. parseFeedFromFile :: FilePath -> IO (Maybe Feed) -parseFeedFromFile fp = parseFeedString <$> utf8readFile fp +parseFeedFromFile fp = parseFeedString <$> utf8readFile fp -- | 'parseFeedWithParser tries to parse the string @str@ -- as one of the feed formats. First as Atom, then RSS2 before diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/Feed/Query.hs new/feed-1.3.2.0/src/Text/Feed/Query.hs --- old/feed-1.3.0.1/src/Text/Feed/Query.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/Feed/Query.hs 2021-03-10 06:18:00.000000000 +0100 @@ -42,6 +42,7 @@ , getItemCategories -- :: ItemGetter [Text] , getItemRights -- :: ItemGetter Text , getItemSummary -- :: ItemGetter Text + , getItemContent -- :: ItemGetter Text , getItemDescription -- :: ItemGetter Text (synonym of previous.) ) where @@ -430,6 +431,14 @@ where isRights dc = dcElt dc == DC_Rights +getItemContent :: ItemGetter Text +getItemContent it = + case it of + Feed.AtomItem e -> atomContentToStr <$> Atom.entryContent e + Feed.RSSItem e -> RSS.rssItemContent e + Feed.RSS1Item _ -> Nothing + Feed.XMLItem i -> strContent <$> findElement (atomName "content") i + getItemSummary :: ItemGetter Text getItemSummary = getItemDescription @@ -447,6 +456,15 @@ toStr (Just (Left x)) = x toStr (Just (Right x)) = x +atomContentToStr :: EntryContent -> Text +atomContentToStr entry = + case entry of + HTMLContent e -> e + XHTMLContent e -> T.unlines $ elementText e + MixedContent text _ -> fromMaybe "" text + ExternalContent _ b -> b + TextContent text -> text + contentToStr :: TextContent -> Text contentToStr x = case x of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/RSS/Export.hs new/feed-1.3.2.0/src/Text/RSS/Export.hs --- old/feed-1.3.0.1/src/Text/RSS/Export.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/RSS/Export.hs 2021-03-10 07:17:26.000000000 +0100 @@ -33,10 +33,10 @@ import Prelude.Compat +import qualified Data.Text.Util as U import Data.XML.Compat import Data.XML.Types as XML import Text.RSS.Syntax -import qualified Data.Text.Util as U import Data.Text (Text, pack) import qualified Data.Text.Lazy as TL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/RSS/Import.hs new/feed-1.3.2.0/src/Text/RSS/Import.hs --- old/feed-1.3.0.1/src/Text/RSS/Import.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/RSS/Import.hs 2021-03-10 06:18:00.000000000 +0100 @@ -221,6 +221,7 @@ , rssItemAuthor = pLeaf "author" es `mplus` pQLeaf (dcName "creator") es , rssItemCategories = pMany "category" elementToCategory es , rssItemComments = pLeaf "comments" es + , rssItemContent = pLeaf "content" es , rssItemEnclosure = pNode "enclosure" es >>= elementToEnclosure , rssItemGuid = pNode "guid" es >>= elementToGuid , rssItemPubDate = pLeaf "pubDate" es `mplus` pQLeaf (dcName "date") es diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/RSS/Syntax.hs new/feed-1.3.2.0/src/Text/RSS/Syntax.hs --- old/feed-1.3.0.1/src/Text/RSS/Syntax.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/RSS/Syntax.hs 2021-03-10 07:17:26.000000000 +0100 @@ -48,109 +48,130 @@ -- * Core Types -- ^The Radio Userland version of RSS documents\/feeds. -- (versions 0.9x, 2.x) -data RSS = RSS - { rssVersion :: Text - , rssAttrs :: [Attr] - , rssChannel :: RSSChannel - , rssOther :: [XML.Element] - } deriving (Show) +data RSS = + RSS + { rssVersion :: Text + , rssAttrs :: [Attr] + , rssChannel :: RSSChannel + , rssOther :: [XML.Element] + } + deriving (Show) type URLString = Text -- | RFC 822 conforming. type DateString = Text -data RSSChannel = RSSChannel - { rssTitle :: Text - , rssLink :: URLString - , rssDescription :: Text - , rssItems :: [RSSItem] - , rssLanguage :: Maybe Text - , rssCopyright :: Maybe Text - , rssEditor :: Maybe Text - , rssWebMaster :: Maybe Text - , rssPubDate :: Maybe DateString -- ^ rfc 822 conforming. - , rssLastUpdate :: Maybe DateString -- ^ rfc 822 conforming. - , rssCategories :: [RSSCategory] - , rssGenerator :: Maybe Text - , rssDocs :: Maybe URLString - , rssCloud :: Maybe RSSCloud - , rssTTL :: Maybe Integer - , rssImage :: Maybe RSSImage - , rssRating :: Maybe Text - , rssTextInput :: Maybe RSSTextInput - , rssSkipHours :: Maybe [Integer] - , rssSkipDays :: Maybe [Text] - , rssChannelOther :: [XML.Element] - } deriving (Show) - -data RSSItem = RSSItem - { rssItemTitle :: Maybe Text - , rssItemLink :: Maybe URLString - , rssItemDescription :: Maybe Text -- ^if not present, the title is. (per spec, at least.) - , rssItemAuthor :: Maybe Text - , rssItemCategories :: [RSSCategory] - , rssItemComments :: Maybe URLString - , rssItemEnclosure :: Maybe RSSEnclosure - , rssItemGuid :: Maybe RSSGuid - , rssItemPubDate :: Maybe DateString - , rssItemSource :: Maybe RSSSource - , rssItemAttrs :: [Attr] - , rssItemOther :: [XML.Element] - } deriving (Show) - -data RSSSource = RSSSource - { rssSourceURL :: URLString - , rssSourceAttrs :: [Attr] - , rssSourceTitle :: Text - } deriving (Show) - -data RSSEnclosure = RSSEnclosure - { rssEnclosureURL :: URLString - , rssEnclosureLength :: Maybe Integer - , rssEnclosureType :: Text - , rssEnclosureAttrs :: [Attr] - } deriving (Show) - -data RSSCategory = RSSCategory - { rssCategoryDomain :: Maybe Text - , rssCategoryAttrs :: [Attr] - , rssCategoryValue :: Text - } deriving (Show) - -data RSSGuid = RSSGuid - { rssGuidPermanentURL :: Maybe Bool - , rssGuidAttrs :: [Attr] - , rssGuidValue :: Text - } deriving (Show) - -data RSSImage = RSSImage - { rssImageURL :: URLString -- the URL to the image resource. - , rssImageTitle :: Text - , rssImageLink :: URLString -- URL that the image resource should be an href to. - , rssImageWidth :: Maybe Integer - , rssImageHeight :: Maybe Integer - , rssImageDesc :: Maybe Text - , rssImageOther :: [XML.Element] - } deriving (Show) - -data RSSCloud = RSSCloud - { rssCloudDomain :: Maybe Text - , rssCloudPort :: Maybe Text -- on purpose (i.e., not an int) - , rssCloudPath :: Maybe Text - , rssCloudRegisterProcedure :: Maybe Text - , rssCloudProtocol :: Maybe Text - , rssCloudAttrs :: [Attr] - } deriving (Show) - -data RSSTextInput = RSSTextInput - { rssTextInputTitle :: Text - , rssTextInputDesc :: Text - , rssTextInputName :: Text - , rssTextInputLink :: URLString - , rssTextInputAttrs :: [Attr] - , rssTextInputOther :: [XML.Element] - } deriving (Show) +data RSSChannel = + RSSChannel + { rssTitle :: Text + , rssLink :: URLString + , rssDescription :: Text + , rssItems :: [RSSItem] + , rssLanguage :: Maybe Text + , rssCopyright :: Maybe Text + , rssEditor :: Maybe Text + , rssWebMaster :: Maybe Text + , rssPubDate :: Maybe DateString -- ^ rfc 822 conforming. + , rssLastUpdate :: Maybe DateString -- ^ rfc 822 conforming. + , rssCategories :: [RSSCategory] + , rssGenerator :: Maybe Text + , rssDocs :: Maybe URLString + , rssCloud :: Maybe RSSCloud + , rssTTL :: Maybe Integer + , rssImage :: Maybe RSSImage + , rssRating :: Maybe Text + , rssTextInput :: Maybe RSSTextInput + , rssSkipHours :: Maybe [Integer] + , rssSkipDays :: Maybe [Text] + , rssChannelOther :: [XML.Element] + } + deriving (Show) + +data RSSItem = + RSSItem + { rssItemTitle :: Maybe Text + , rssItemLink :: Maybe URLString + , rssItemDescription :: Maybe Text -- ^if not present, the title is. (per spec, at least.) + , rssItemAuthor :: Maybe Text + , rssItemCategories :: [RSSCategory] + , rssItemComments :: Maybe URLString + , rssItemContent :: Maybe Text + , rssItemEnclosure :: Maybe RSSEnclosure + , rssItemGuid :: Maybe RSSGuid + , rssItemPubDate :: Maybe DateString + , rssItemSource :: Maybe RSSSource + , rssItemAttrs :: [Attr] + , rssItemOther :: [XML.Element] + } + deriving (Show) + +data RSSSource = + RSSSource + { rssSourceURL :: URLString + , rssSourceAttrs :: [Attr] + , rssSourceTitle :: Text + } + deriving (Show) + +data RSSEnclosure = + RSSEnclosure + { rssEnclosureURL :: URLString + , rssEnclosureLength :: Maybe Integer + , rssEnclosureType :: Text + , rssEnclosureAttrs :: [Attr] + } + deriving (Show) + +data RSSCategory = + RSSCategory + { rssCategoryDomain :: Maybe Text + , rssCategoryAttrs :: [Attr] + , rssCategoryValue :: Text + } + deriving (Show) + +data RSSGuid = + RSSGuid + { rssGuidPermanentURL :: Maybe Bool + , rssGuidAttrs :: [Attr] + , rssGuidValue :: Text + } + deriving (Show) + +data RSSImage = + RSSImage + { rssImageURL :: URLString -- the URL to the image resource. + , rssImageTitle :: Text + , rssImageLink :: URLString -- URL that the image resource should be an href to. + , rssImageWidth :: Maybe Integer + , rssImageHeight :: Maybe Integer + , rssImageDesc :: Maybe Text + , rssImageOther :: [XML.Element] + } + deriving (Show) + +data RSSCloud = + RSSCloud + { rssCloudDomain :: Maybe Text + , rssCloudPort :: Maybe Text -- on purpose (i.e., not an int) + , rssCloudPath :: Maybe Text + , rssCloudRegisterProcedure :: Maybe Text + , rssCloudProtocol :: Maybe Text + , rssCloudAttrs :: [Attr] + } + deriving (Show) + +data RSSTextInput = + RSSTextInput + { rssTextInputTitle :: Text + , rssTextInputDesc :: Text + , rssTextInputName :: Text + , rssTextInputLink :: URLString + , rssTextInputAttrs :: [Attr] + , rssTextInputOther :: [XML.Element] + } + deriving (Show) -- * Default Constructors: nullRSS :: @@ -200,6 +221,7 @@ , rssItemAuthor = Nothing , rssItemCategories = [] , rssItemComments = Nothing + , rssItemContent = Nothing , rssItemEnclosure = Nothing , rssItemGuid = Nothing , rssItemPubDate = Nothing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/RSS1/Export.hs new/feed-1.3.2.0/src/Text/RSS1/Export.hs --- old/feed-1.3.0.1/src/Text/RSS1/Export.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/RSS1/Export.hs 2021-03-10 07:17:26.000000000 +0100 @@ -17,10 +17,10 @@ import Prelude.Compat +import qualified Data.Text.Util as U import Text.DublinCore.Types import Text.RSS1.Syntax import Text.RSS1.Utils -import qualified Data.Text.Util as U import Data.List.Compat import Data.Text (Text) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/src/Text/RSS1/Syntax.hs new/feed-1.3.2.0/src/Text/RSS1/Syntax.hs --- old/feed-1.3.0.1/src/Text/RSS1/Syntax.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/src/Text/RSS1/Syntax.hs 2021-03-10 07:17:26.000000000 +0100 @@ -47,79 +47,91 @@ type TextString = Text -data Feed = Feed - { feedVersion :: Text - , feedChannel :: Channel - , feedImage :: Maybe Image - , feedItems :: [Item] - , feedTextInput :: Maybe TextInputInfo - , feedTopics :: [TaxonomyTopic] - , feedOther :: [XML.Element] - , feedAttrs :: [Attr] - } deriving (Show) - -data Channel = Channel - { channelURI :: URIString - , channelTitle :: TitleString - , channelLink :: URIString - , channelDesc :: TextString +data Feed = + Feed + { feedVersion :: Text + , feedChannel :: Channel + , feedImage :: Maybe Image + , feedItems :: [Item] + , feedTextInput :: Maybe TextInputInfo + , feedTopics :: [TaxonomyTopic] + , feedOther :: [XML.Element] + , feedAttrs :: [Attr] + } + deriving (Show) + +data Channel = + Channel + { channelURI :: URIString + , channelTitle :: TitleString + , channelLink :: URIString + , channelDesc :: TextString -- these are indirect RDF associations to elements declared -- outside the channel element in the RDF \/ feed document. - , channelImageURI :: Maybe URIString - , channelItemURIs :: [URIString] - , channelTextInputURI :: Maybe URIString - , channelDC :: [DCItem] - , channelUpdatePeriod :: Maybe UpdatePeriod - , channelUpdateFreq :: Maybe Integer - , channelUpdateBase :: Maybe TimeString -- format is yyyy-mm-ddThh:mm - , channelContent :: [ContentInfo] - , channelTopics :: [URIString] - , channelOther :: [XML.Element] - , channelAttrs :: [Attr] - } deriving (Show) - -data Image = Image - { imageURI :: URIString -- the image resource, most likely. - , imageTitle :: TextString -- the "alt"ernative text. - , imageURL :: URIString - , imageLink :: URIString -- the href of the rendered img resource. - , imageDC :: [DCItem] - , imageOther :: [XML.Element] - , imageAttrs :: [Attr] - } deriving (Show) - -data Item = Item - { itemURI :: URIString - , itemTitle :: TextString - , itemLink :: URIString - , itemDesc :: Maybe TextString - , itemDC :: [DCItem] - , itemTopics :: [URIString] - , itemContent :: [ContentInfo] - , itemOther :: [XML.Element] - , itemAttrs :: [Attr] - } deriving (Show) - -data TextInputInfo = TextInputInfo - { textInputURI :: URIString - , textInputTitle :: TextString - , textInputDesc :: TextString - , textInputName :: TextString - , textInputLink :: URIString - , textInputDC :: [DCItem] - , textInputOther :: [XML.Element] - , textInputAttrs :: [Attr] - } deriving (Show) - -data TaxonomyTopic = TaxonomyTopic - { taxonomyURI :: URIString - , taxonomyLink :: URIString - , taxonomyTitle :: Maybe Text - , taxonomyDesc :: Maybe Text - , taxonomyTopics :: [URIString] - , taxonomyDC :: [DCItem] - , taxonomyOther :: [XML.Element] - } deriving (Show) + , channelImageURI :: Maybe URIString + , channelItemURIs :: [URIString] + , channelTextInputURI :: Maybe URIString + , channelDC :: [DCItem] + , channelUpdatePeriod :: Maybe UpdatePeriod + , channelUpdateFreq :: Maybe Integer + , channelUpdateBase :: Maybe TimeString -- format is yyyy-mm-ddThh:mm + , channelContent :: [ContentInfo] + , channelTopics :: [URIString] + , channelOther :: [XML.Element] + , channelAttrs :: [Attr] + } + deriving (Show) + +data Image = + Image + { imageURI :: URIString -- the image resource, most likely. + , imageTitle :: TextString -- the "alt"ernative text. + , imageURL :: URIString + , imageLink :: URIString -- the href of the rendered img resource. + , imageDC :: [DCItem] + , imageOther :: [XML.Element] + , imageAttrs :: [Attr] + } + deriving (Show) + +data Item = + Item + { itemURI :: URIString + , itemTitle :: TextString + , itemLink :: URIString + , itemDesc :: Maybe TextString + , itemDC :: [DCItem] + , itemTopics :: [URIString] + , itemContent :: [ContentInfo] + , itemOther :: [XML.Element] + , itemAttrs :: [Attr] + } + deriving (Show) + +data TextInputInfo = + TextInputInfo + { textInputURI :: URIString + , textInputTitle :: TextString + , textInputDesc :: TextString + , textInputName :: TextString + , textInputLink :: URIString + , textInputDC :: [DCItem] + , textInputOther :: [XML.Element] + , textInputAttrs :: [Attr] + } + deriving (Show) + +data TaxonomyTopic = + TaxonomyTopic + { taxonomyURI :: URIString + , taxonomyLink :: URIString + , taxonomyTitle :: Maybe Text + , taxonomyDesc :: Maybe Text + , taxonomyTopics :: [URIString] + , taxonomyDC :: [DCItem] + , taxonomyOther :: [XML.Element] + } + deriving (Show) data UpdatePeriod = Update_Hourly @@ -129,12 +141,14 @@ | Update_Yearly deriving (Eq, Show) -data ContentInfo = ContentInfo - { contentURI :: Maybe URIString - , contentFormat :: Maybe URIString - , contentEncoding :: Maybe URIString - , contentValue :: Maybe Text -- should be: RDFValue - } deriving (Eq, Show) +data ContentInfo = + ContentInfo + { contentURI :: Maybe URIString + , contentFormat :: Maybe URIString + , contentEncoding :: Maybe URIString + , contentValue :: Maybe Text -- should be: RDFValue + } + deriving (Eq, Show) --default constructors: nullFeed :: URIString -> TitleString -> Feed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/tests/Example/CreateAtom.hs new/feed-1.3.2.0/tests/Example/CreateAtom.hs --- old/feed-1.3.0.1/tests/Example/CreateAtom.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/tests/Example/CreateAtom.hs 2021-03-10 07:17:26.000000000 +0100 @@ -15,11 +15,12 @@ atomFeed :: Maybe Text atomFeed = renderFeed examplePosts -data Post = Post - { _postedOn :: Text - , _url :: Text - , _content :: Text - } +data Post = + Post + { _postedOn :: Text + , _url :: Text + , _content :: Text + } examplePosts :: [Post] examplePosts = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/tests/ImportExport.hs new/feed-1.3.2.0/tests/ImportExport.hs --- old/feed-1.3.0.1/tests/ImportExport.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/tests/ImportExport.hs 2021-03-10 07:17:26.000000000 +0100 @@ -6,11 +6,11 @@ import Data.Generics (everywhere, mkT) import Data.Text (strip) +import qualified Data.Text.Lazy.IO as T +import qualified Data.XML.Types as XML import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Test.HUnit ((@=?)) -import qualified Data.Text.Lazy.IO as T -import qualified Data.XML.Types as XML import qualified Text.XML as C import Text.Feed.Export (xmlFeed) @@ -21,26 +21,24 @@ import Paths_feed importExportTests :: Test -importExportTests = testGroup "ImportExport" - [ testImportExport readAtom "tests/files/import_export_atom.xml" - ] +importExportTests = + testGroup "ImportExport" [testImportExport readAtom "tests/files/import_export_atom.xml"] testImportExport :: (XML.Element -> Maybe Feed) -> FilePath -> Test -testImportExport readFeed fileName = testCase fileName $ do - input <- T.readFile =<< getDataFileName fileName - let inputXml = C.parseText_ C.def input - let Just feed = readFeed $ C.toXMLElement $ C.documentRoot inputXml - let Just outputXml = elementToDoc $ xmlFeed feed - let output = C.renderText C.def outputXml - let input' = C.renderText C.def $ stripXmlWhitespace inputXml - input' @=? output +testImportExport readFeed fileName = + testCase fileName $ do + input <- T.readFile =<< getDataFileName fileName + let inputXml = C.parseText_ C.def input + let Just feed = readFeed $ C.toXMLElement $ C.documentRoot inputXml + let Just outputXml = elementToDoc $ xmlFeed feed + let output = C.renderText C.def outputXml + let input' = C.renderText C.def $ stripXmlWhitespace inputXml + input' @=? output stripXmlWhitespace :: C.Document -> C.Document stripXmlWhitespace = everywhere (mkT stripWhitespaceNodes) where - stripWhitespaceNodes e = - e { C.elementNodes = filter (not . isWhite) (C.elementNodes e) } - + stripWhitespaceNodes e = e {C.elementNodes = filter (not . isWhite) (C.elementNodes e)} isWhite (C.NodeContent t) = strip t == "" isWhite (C.NodeComment _) = True isWhite _ = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/tests/Main.hs new/feed-1.3.2.0/tests/Main.hs --- old/feed-1.3.0.1/tests/Main.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/tests/Main.hs 2021-03-10 07:17:26.000000000 +0100 @@ -13,4 +13,6 @@ import Text.RSS.Tests (rssTests) main :: IO () -main = defaultMain [rssTests, atomTests, atomValidateTests, feedUtilTests, exampleTests, importExportTests] +main = + defaultMain + [rssTests, atomTests, atomValidateTests, feedUtilTests, exampleTests, importExportTests] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/tests/Text/Atom/Validate/Tests.hs new/feed-1.3.2.0/tests/Text/Atom/Validate/Tests.hs --- old/feed-1.3.0.1/tests/Text/Atom/Validate/Tests.hs 2020-03-20 21:15:15.000000000 +0100 +++ new/feed-1.3.2.0/tests/Text/Atom/Validate/Tests.hs 2021-03-10 07:17:26.000000000 +0100 @@ -18,13 +18,11 @@ import qualified Text.XML as C atomValidateTests :: Test -atomValidateTests = - testGroup - "Text.Atom.Validate" - [testAtomValidate] +atomValidateTests = testGroup "Text.Atom.Validate" [testAtomValidate] sampleEntryText :: Text -sampleEntryText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><entry xmlns=\"http://www.w3.org/2005/Atom\"><id>http://example.com</id><title type=\"text\">example</title><updated>2000-01-01T00:00:00Z</updated><author><name>Nobody</name></author><content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\">This is <b>XHTML</b> content.</div></content></entry>" +sampleEntryText = + "<?xml version=\"1.0\" encoding=\"UTF-8\"?><entry xmlns=\"http://www.w3.org/2005/Atom\"><id>http://example.com</id><title type=\"text\">example</title><updated>2000-01-01T00:00:00Z</updated><author><name>Nobody</name></author><content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\">This is <b>XHTML</b> content.</div></content></entry>" testAtomValidate :: Test testAtomValidate = testCase "simple entry is valid" testValid diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/feed-1.3.0.1/tests/doctest-driver.hs new/feed-1.3.2.0/tests/doctest-driver.hs --- old/feed-1.3.0.1/tests/doctest-driver.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/feed-1.3.2.0/tests/doctest-driver.hs 2021-03-10 07:17:26.000000000 +0100 @@ -0,0 +1 @@ +{-# OPTIONS_GHC -F -pgmF doctest-driver-gen -optF README.lhs -optF -pgmL -optF markdown-unlit -optF -XOverloadedStrings -optF -XNoImplicitPrelude -optF -package -optF text -optF -package -optF xml-types #-}