feed 0.3.9.2 → 0.3.9.3
raw patch · 5 files changed
+23/−14 lines, 5 filesdep +time-locale-compatdep ~timedep ~utf8-stringnew-uploader
Dependencies added: time-locale-compat
Dependency ranges changed: time, utf8-string
Files
- CHANGES +4/−0
- Text/Feed/Import.hs +13/−1
- Text/Feed/Query.hs +2/−1
- feed.cabal +3/−3
- tests/Main.hs +1/−9
CHANGES view
@@ -1,3 +1,7 @@+Version 0.3.9.3:++* Add support for utf8-string >= 1 && < 1.1 and time 1.5.*+ Version 0.3.9.1: * add ref to github repo + .cabal tidying.
Text/Feed/Import.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -------------------------------------------------------------------- -- | -- Module : Text.Feed.Import@@ -32,13 +33,24 @@ import Control.Monad +#if MIN_VERSION_utf8_string(1,0,0)+import Codec.Binary.UTF8.String (decodeString)+import System.IO (IOMode(..), hGetContents, openBinaryFile )+utf8readFile :: FilePath -> IO String+utf8readFile fp = fmap decodeString (hGetContents =<< openBinaryFile fp ReadMode)+#else import System.IO.UTF8 as UTF8 ( readFile )+utf8readFile :: FilePath -> IO String+utf8readFile = UTF8.readFile+#endif ++ -- | 'parseFeedFromFile fp' reads in the contents of the file at @fp@; -- the assumed encoding is UTF-8. parseFeedFromFile :: FilePath -> IO Feed parseFeedFromFile fp = do- ls <- UTF8.readFile fp+ ls <- utf8readFile fp case parseFeedString ls of Nothing -> fail ("parseFeedFromFile: not a well-formed XML content in: " ++ fp) Just f -> return f
Text/Feed/Query.hs view
@@ -62,7 +62,8 @@ import Data.Maybe -- for getItemPublishDate rfc822 date parsing.-import System.Locale ( rfc822DateFormat, iso8601DateFormat, defaultTimeLocale )+import System.Locale ( rfc822DateFormat, iso8601DateFormat )+import Data.Time.Locale.Compat ( defaultTimeLocale ) import Data.Time.Format ( ParseTime, parseTime ) feedItems :: Feed.Feed -> [Feed.Item]
feed.cabal view
@@ -1,5 +1,5 @@ Name: feed-Version: 0.3.9.2+Version: 0.3.9.3 License: BSD3 License-file: LICENSE Category: Text@@ -47,5 +47,5 @@ old-time >= 1, xml >= 1.2.6, utf8-string,- time-+ time,+ time-locale-compat >= 0.1 && < 0.2
tests/Main.hs view
@@ -1,21 +1,13 @@ module Main where import Text.XML.Light-import Text.Feed.Types import Text.Feed.Import import Text.Feed.Export import System.Environment -pFromFile :: FilePath -> IO Feed-pFromFile fp = do- ls <- readFile fp- case parseFeedString ls of- Nothing -> fail ("parseFeedFromFile: not a well-formed XML content in: " ++ fp)- Just f -> return f- main :: IO () main = do (x:_) <- getArgs- feed <- pFromFile x+ feed <- parseFeedFromFile x putStrLn (ppTopElement $ xmlFeed feed)