-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Streaming HTML parser -- -- Streaming HTML parser @package list-t-html-parser @version 0.4.2 module ListT.HTMLParser -- | A backtracking HTML-tokens stream parser. data Parser m a -- | A possibly detailed parser error. When mzero or empty is -- used, an error value of Nothing is produced. type Error = Maybe ErrorDetails data ErrorDetails -- | A text message ErrorDetails_Message :: Text -> ErrorDetails -- | Unexpected token ErrorDetails_UnexpectedToken :: ErrorDetails -- | End of input ErrorDetails_EOI :: ErrorDetails -- | Run a parser on a stream of HTML tokens, consuming only as many as -- needed. run :: Monad m => Parser m a -> ListT m Token -> m (Either Error a) -- | End of input. eoi :: Monad m => Parser m () -- | A token with HTML entities decoded and with spaces filtered out. token :: Monad m => Parser m Token -- | An HTML token as it is: without HTML-decoding and ignoring of spaces. rawToken :: Monad m => Parser m Token -- | A text token, which is completely composed of characters, which -- satisfy the isSpace predicate. space :: Monad m => Parser m Text -- | An opening tag with HTML entities in values decoded. openingTag :: Monad m => Parser m OpeningTag -- | A closing tag. closingTag :: Monad m => Parser m Identifier -- | A text between tags with HTML entities decoded. text :: Monad m => Parser m Text -- | Contents of a comment. comment :: Monad m => Parser m Text -- | The auto-repaired textual HTML representation of an HTML-tree node. -- -- Useful for consuming HTML-formatted snippets. -- -- E.g., when the following parser: -- --
-- openingTag *> html ---- -- is run against the following HTML snippet: -- --
-- <ul> -- <li>I'm not your friend, <b>buddy</b>!</li> -- <li>I'm not your buddy, <b>guy</b>!</li> -- <li>He's not your guy, <b>friend</b>!</li> -- <li>I'm not your friend, <b>buddy</b>!</li> -- </ul> ---- -- it'll produce the following text builder value: -- --
-- <li>I'm not your friend, <b>buddy</b>!</li> ---- -- If you want to consume all children of a node, it's recommended to use -- properHTML in combination with many or many1. For -- details consult the docs on properHTML. -- -- This parser is smart and handles and repairs broken HTML: -- --
-- openingTag *> (mconcat <$> many properHTML) ---- -- on the following input: -- --
-- <ul> -- <li>I'm not your friend, <b>buddy</b>!</li> -- <li>I'm not your buddy, <b>guy</b>!</li> -- <li>He's not your guy, <b>friend</b>!</li> -- <li>I'm not your friend, <b>buddy</b>!</li> -- </ul> ---- -- will produce a merged text builder, which consists of the following -- nodes: -- --
-- <li>I'm not your friend, <b>buddy</b>!</li> -- <li>I'm not your buddy, <b>guy</b>!</li> -- <li>He's not your guy, <b>friend</b>!</li> -- <li>I'm not your friend, <b>buddy</b>!</li> ---- -- Notice that unlike with html, it's safe to assume that it will -- not consume the following closing </ul> tag, because it -- does not begin a valid HTML-tree node. -- -- Notice also that despite failing in case of the first broken token, -- this parser handles the broken tokens in other cases the same way as -- html. properHTML :: Monad m => Parser m Builder -- | Works the same way as properHTML, but constructs an XML-tree. xmlNode :: Monad m => Parser m Node -- | Apply a parser at least one time. many1 :: Monad m => Parser m a -> Parser m [a] -- | Apply a parser multiple times until another parser is satisfied. -- Returns results of both parsers. manyTill :: Monad m => Parser m a -> Parser m b -> Parser m ([a], b) -- | Skip any tokens until the provided parser is satisfied. skipTill :: Monad m => Parser m a -> Parser m a -- | Greedily consume all the input until the end, while running the -- provided parser. Same as: -- --
-- theParser <* eoi --total :: Monad m => Parser m a -> Parser m a instance GHC.Base.Monad m => Control.Monad.Error.Class.MonadError ListT.HTMLParser.Error (ListT.HTMLParser.Parser m) instance GHC.Base.Monad m => GHC.Base.Applicative (ListT.HTMLParser.Parser m) instance GHC.Base.Monad m => GHC.Base.Functor (ListT.HTMLParser.Parser m) instance GHC.Classes.Eq ListT.HTMLParser.ErrorDetails instance GHC.Show.Show ListT.HTMLParser.ErrorDetails instance GHC.Base.Monad m => GHC.Base.Monad (ListT.HTMLParser.Parser m) instance GHC.Base.Monad m => GHC.Base.Alternative (ListT.HTMLParser.Parser m) instance GHC.Base.Monad m => GHC.Base.MonadPlus (ListT.HTMLParser.Parser m)