diff options
author | koral <> | 2017-02-18 12:38:00 (GMT) |
---|---|---|
committer | hdiff <hdiff@hdiff.luite.com> | 2017-02-18 12:38:00 (GMT) |
commit | 66922dc37462eda7f9332e30badb42de0a30ab1c (patch) | |
tree | 57159a1eec920363853ada71f88e0247b4d366ab | |
parent | 4685e169a0e25ba2ed6c7272d9226a14ebebc29a (diff) |
version 0.6.0.20.6.0.2
-rw-r--r-- | Text/OPML/Conduit/Parse.hs | 18 | ||||
-rw-r--r-- | opml-conduit.cabal | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Text/OPML/Conduit/Parse.hs b/Text/OPML/Conduit/Parse.hs index 5a6515d..bfd820e 100644 --- a/Text/OPML/Conduit/Parse.hs +++ b/Text/OPML/Conduit/Parse.hs @@ -21,7 +21,7 @@ module Text.OPML.Conduit.Parse -- {{{ Imports import Conduit hiding (throwM) -import Control.Applicative hiding(many) +import Control.Applicative hiding (many) import Control.Exception.Safe as Exception import Control.Monad import Control.Monad.Fix @@ -106,19 +106,19 @@ asNonNull = maybe (throwM MissingText) return . fromNullable asCategories :: Text -> [NonEmpty (NonNull Text)] asCategories = mapMaybe (nonEmpty . mapMaybe fromNullable . split (== '/')) . split (== ',') -dateTag :: (MonadThrow m) => Name -> ConduitM Event o m (Maybe UTCTime) +dateTag :: (MonadThrow m) => NameMatcher a -> ConduitM Event o m (Maybe UTCTime) dateTag name = tagIgnoreAttrs name $ content >>= asTime -uriTag :: (MonadThrow m) => Name -> ConduitM Event o m (Maybe URI) +uriTag :: (MonadThrow m) => NameMatcher a -> ConduitM Event o m (Maybe URI) uriTag name = tagIgnoreAttrs name $ content >>= asURI expansionStateTag :: (MonadThrow m, Integral a) => ConduitM Event o m (Maybe [a]) expansionStateTag = tagIgnoreAttrs "expansionState" $ content >>= asExpansionState -textTag :: (MonadThrow m) => Name -> ConduitM Event o m (Maybe Text) +textTag :: (MonadThrow m) => NameMatcher a -> ConduitM Event o m (Maybe Text) textTag name = tagIgnoreAttrs name content -decimalTag :: (Integral a, MonadThrow m) => Name -> ConduitM Event o m (Maybe a) +decimalTag :: (Integral i, MonadThrow m) => NameMatcher a -> ConduitM Event o m (Maybe i) decimalTag name = tagIgnoreAttrs name $ content >>= asDecimal projectC :: Monad m => Fold a a' b b' -> Conduit a m b @@ -153,7 +153,7 @@ makeTraversals ''HeadPiece -- - each sub-element may be repeated, in which case only the first occurrence is taken into account; -- - each unknown sub-element is ignored. parseOpmlHead :: (MonadCatch m) => ConduitM Event o m (Maybe OpmlHead) -parseOpmlHead = tagIgnoreAttrs "head" $ (manyYield' (choose piece) <* many ignoreAllTreesContent) =$= zipConduit where +parseOpmlHead = tagIgnoreAttrs "head" $ (manyYield' (choose piece) <* many ignoreAnyTreeContent) =$= zipConduit where zipConduit = getZipConduit $ OpmlHead <$> ZipConduit (projectC _HeadTitle =$= headDefC mempty) <*> ZipConduit (projectC _HeadCreated =$= headC) @@ -187,7 +187,7 @@ parseOpmlHead = tagIgnoreAttrs "head" $ (manyYield' (choose piece) <* many ignor -- | Parse an @\<outline\>@ section. -- The value of type attributes are not case-sensitive, that is @type=\"LINK\"@ has the same meaning as @type="link"@. parseOpmlOutline :: (MonadCatch m) => ConduitM Event o m (Maybe (Tree OpmlOutline)) -parseOpmlOutline = tagName "outline" attributes handler where +parseOpmlOutline = tag' "outline" attributes handler where attributes = do otype <- optional $ requireAttr "type" case mk <$> otype of @@ -222,9 +222,9 @@ makeTraversals ''OpmlDocPiece -- | Parse the top-level @\<opml\>@ element. parseOpml :: (MonadCatch m) => ConduitM Event o m (Maybe Opml) -parseOpml = tagName "opml" attributes handler where +parseOpml = tag' "opml" attributes handler where attributes = (requireAttr "version" >>= asVersion) <* ignoreAttrs - handler version = (manyYield' (choose piece) <* many ignoreAllTreesContent) =$= zipConduit version + handler version = (manyYield' (choose piece) <* many ignoreAnyTreeContent) =$= zipConduit version zipConduit version = getZipConduit $ Opml version <$> ZipConduit (projectC _DocHead =$= headDefC mkOpmlHead) <*> ZipConduit (projectC _DocBody =$= headDefC mempty) diff --git a/opml-conduit.cabal b/opml-conduit.cabal index 3961ce6..97a0091 100644 --- a/opml-conduit.cabal +++ b/opml-conduit.cabal @@ -1,5 +1,5 @@ name: opml-conduit -version: 0.6.0.1 +version: 0.6.0.2 synopsis: Streaming parser/renderer for the OPML 2.0 format. description: This library implements the OPML 2.0 standard (<http://dev.opml.org/spec2.html>) as a 'conduit' parser/renderer. @@ -45,7 +45,7 @@ library , time >= 1.5 , timerep >= 2.0.0 , uri-bytestring >= 0.2 - , xml-conduit >= 1.3 + , xml-conduit >= 1.5 , xml-types default-language: Haskell2010 ghc-options: -Wall -fno-warn-unused-do-bind |