iCalendar 0.4.0.2 → 0.4.0.3
raw patch · 6 files changed
+33/−19 lines, 6 filesdep ~mimedep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: mime, time
API changes (from Hackage documentation)
Files
- Text/ICalendar/Parser/Common.hs +11/−6
- Text/ICalendar/Parser/Content.hs +1/−1
- Text/ICalendar/Parser/Parameters.hs +2/−2
- Text/ICalendar/Parser/Properties.hs +2/−1
- Text/ICalendar/Printer.hs +9/−2
- iCalendar.cabal +8/−7
Text/ICalendar/Parser/Common.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE CPP #-} module Text.ICalendar.Parser.Common where import Control.Applicative@@ -29,8 +30,13 @@ import Data.Traversable (mapM) import qualified Network.URI as URI import Prelude hiding (mapM)-import qualified System.Locale as L +#if MIN_VERSION_time(1,5,0)+import Data.Time (defaultTimeLocale)+#else+import System.Locale (defaultTimeLocale)+#endif+ import qualified Text.Parsec as P import Text.Parsec.Combinator hiding (optional) import Text.Parsec.Prim hiding ((<|>))@@ -74,7 +80,7 @@ '\\' -> nxt '\\' ';' -> nxt ';' ',' -> nxt ','- z | z `elem` "nN" -> nxt '\n'+ z | z `elem` ['n','N'] -> nxt '\n' _ -> fail $ "unexpected " ++ show x y -> nxt y -- isTSafe + 0x22, 0x3A, and 0x5C is pattern matched against.@@ -115,12 +121,12 @@ -- | Parse a string to a Day. 3.3.4 parseDateStr :: String -> Maybe (Day, String)-parseDateStr = lastToMaybe . Time.readsTime L.defaultTimeLocale "%Y%m%d"+parseDateStr = lastToMaybe . Time.readSTime True defaultTimeLocale "%Y%m%d" -- | Parse a string to a TimeOfDay, and a bool if it's in UTC. parseTimeStr :: String -> Maybe (TimeOfDay, Bool) parseTimeStr s = do- (t, r) <- lastToMaybe (Time.readsTime L.defaultTimeLocale "%H%M%S" s)+ (t, r) <- lastToMaybe (Time.readSTime True defaultTimeLocale "%H%M%S" s) case r of "Z" -> return (t, True) "" -> return (t, False)@@ -196,8 +202,7 @@ lenientTextOnlyOne [x] = return x lenientTextOnlyOne [] = throwError "Must have one value, not zero." lenientTextOnlyOne xs = do- tell ["Illegal comma in value that only allows one TEXT, assuming\- \ literal comma was intended."]+ tell ["Illegal comma in value that only allows one TEXT, assuming literal comma was intended."] return $ T.intercalate "," xs -- | Parse something '[Text]' with alternative representations, language
Text/ICalendar/Parser/Content.hs view
@@ -75,7 +75,7 @@ isControl', isSafe, isValue, isQSafe, isName :: Char -> Bool isControl' c = c /= '\t' && isControl c-isSafe c = not (isControl' c) && c `notElem` "\";:,"+isSafe c = not (isControl' c) && c `notElem` ("\";:,"::String) isValue c = let n = fromEnum c in n == 32 || n == 9 || (n >= 0x21 && n /= 0x7F) isQSafe c = isValue c && c /= '"' isName c = isAsciiUpper c || isAsciiLower c || isDigit c || c == '-'
Text/ICalendar/Parser/Parameters.hs view
@@ -193,7 +193,7 @@ when (B.null x) . throwError $ "Invalid UTCperiod: " ++ show bs dateTime <- mustBeUTC =<< parseDateTime Nothing dateTime' case B.head x of- z | z `elem` "+-P" -> UTCPeriodDuration dateTime+ z | z `elem` ("+-P"::String) -> UTCPeriodDuration dateTime <$> parseDuration "period" x _ -> UTCPeriodDates dateTime <$> (mustBeUTC =<< parseDateTime Nothing x) @@ -203,6 +203,6 @@ when (B.null x) . throwError $ "Invalid period: " ++ show bs dateTime <- parseDateTime tzid dateTime' case B.head x of- z | z `elem` "+-P" -> PeriodDuration dateTime+ z | z `elem` ("+-P"::String) -> PeriodDuration dateTime <$> parseDuration "period" x _ -> PeriodDates dateTime <$> parseDateTime tzid x
Text/ICalendar/Parser/Properties.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE FlexibleContexts #-} module Text.ICalendar.Parser.Properties where import Control.Applicative@@ -379,7 +380,7 @@ (t1:t2:m1:m2:sec) = map digitToInt rest (s1:s2:_) = sec sign x = if s == '-' then negate x else x- when (length str < 5 || any (not . isDigit) rest || s `notElem` "+-"+ when (length str < 5 || any (not . isDigit) rest || s `notElem` ['+','-'] || length sec `notElem` [0,2]) . throwError $ "parseUTCOffset: " ++ str return . UTCOffset (sign $ ((t1 * 10 + t2) * 60 + (m1 * 10 + m2)) * 60 +
Text/ICalendar/Printer.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE CPP #-} module Text.ICalendar.Printer ( EncodingFunctions(..) , printICalendar@@ -32,7 +33,13 @@ import qualified Data.Version as Ver import qualified Network.URI as URI import Prelude hiding (mapM_)-import qualified System.Locale as L++#if MIN_VERSION_time(1,5,0)+import Data.Time (defaultTimeLocale)+#else+import System.Locale (defaultTimeLocale)+#endif+ import Text.Printf (printf) import Codec.MIME.Type (MIMEType, showMIMEType)@@ -967,6 +974,6 @@ line b = tell (Bu.lazyByteString b) >> newline formatTime :: FormatTime t => String -> t -> String-formatTime = Time.formatTime L.defaultTimeLocale+formatTime = Time.formatTime defaultTimeLocale -- }}}
iCalendar.cabal view
@@ -1,14 +1,14 @@ name: iCalendar-version: 0.4.0.2+version: 0.4.0.3 synopsis: iCalendar data types, parser, and printer. description: Data definitions, parsing and printing of the iCalendar format (RFC5545).-homepage: http://github.com/tingtun/iCalendar-bug-reports: http://github.com/tingtun/iCalendar/issues+homepage: http://github.com/chrra/iCalendar+bug-reports: http://github.com/chrra/iCalendar/issues license: BSD3 license-file: LICENSE author: Christian Rødli Amble-maintainer: cra+code@cra.no+maintainer: cra@cra.no copyright: (c) Tingtun stability: experimental category: Text@@ -18,7 +18,8 @@ source-repository head type: git- location: git://github.com/tingtun/iCalendar.git+ location: git://github.com/chrra/iCalendar.git+ flag network-uri description: Get Network.URI from the network-uri package default: True@@ -40,9 +41,9 @@ else build-depends: network >= 2.4 && < 2.6 - build-depends: base >=4.5 && <5, time ==1.4.*, data-default >=0.3+ build-depends: base >=4.5 && <5, time >=1.5, data-default >=0.3 , case-insensitive >=0.4 , bytestring >=0.10 && < 0.11, parsec >=3.1.0- , text, containers >= 0.5 && < 0.6, mime ==0.4.*+ , text, containers >= 0.5 && < 0.6, mime >=0.4.0.2 , mtl >=2.1.0, old-locale, base64-bytestring ==1.0.* ghc-options: -Wall