| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Scrappy.Elem.ElemHeadParse
Synopsis
- href :: forall s (m :: Type -> Type) u. Stream s m Char => Bool -> LastUrl -> ParsecT s u m Link
- href' :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe CurrentUrl -> ParsecT s u m Link
- parseAttrSafe :: forall s (m :: Type -> Type) u. Stream s m Char => String -> ParsecT s u m String
- hrefParser :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m String
- parseOpeningTagF :: forall s (m :: Type -> Type) u. Stream s m Char => String -> (String -> Bool) -> ParsecT s u m ElemHead
- parseOpeningTagWhere :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> String -> (String -> Bool) -> ParsecT s u m ElemHead
- hrefParser' :: forall s (m :: Type -> Type) u. Stream s m Char => (String -> Bool) -> ParsecT s u m String
- attrValue :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m [Char]
- attrValuesExist :: [(String, String)] -> [(String, Maybe String)] -> Bool
- attrValueExists :: [(String, String)] -> (String, Maybe String) -> Bool
- attrName :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m String
- attrParser :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m (String, String)
- attrsParser :: forall s (m :: Type -> Type) u. Stream s m Char => [(String, Maybe String)] -> ParsecT s u m (Either AttrsError (Map String String))
- isAttrsMatch' :: Map String String -> [(String, Maybe String)] -> Bool
- isAttrsMatch :: Map String String -> [(String, Maybe String)] -> Bool
- attrsFit :: Map String String -> [(String, String -> Bool)] -> Bool
- attrsMatch' :: Map String String -> Map String String -> Bool
- attrsMatch :: [(String, String)] -> Map String String -> Bool
- attrsParserDesc :: forall s (m :: Type -> Type) u. Stream s m Char => [(String, String)] -> ParsecT s u m (Map String String)
- parseOpeningTagDesc :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> [(String, String)] -> ParsecT s u m (Elem, Attrs)
- digitEq :: String -> String -> Bool
- saveDigitEq :: String -> String -> Bool
- svDigEq :: String -> String -> Bool
- digitEqFree :: [Char] -> [Char] -> Bool
- unfit :: [(String, String)] -> Map String String -> [(String, String)]
- mkAttrsDesc :: [(String, String)] -> [(String, String -> Bool)]
- parseOpeningTag :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> [(String, Maybe String)] -> ParsecT s u m (Elem, Attrs)
- mkElemtagParser :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> ParsecT s u m String
- buildElemsOpts :: forall s (m :: Type -> Type) u. Stream s m Char => [Elem] -> ParsecT s u m String
Documentation
href :: forall s (m :: Type -> Type) u. Stream s m Char => Bool -> LastUrl -> ParsecT s u m Link Source #
needs to use many for multiple links
href' :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe CurrentUrl -> ParsecT s u m Link Source #
parseAttrSafe :: forall s (m :: Type -> Type) u. Stream s m Char => String -> ParsecT s u m String Source #
Safe because it forces parse of the entire ElemHead then pulls if there | Designed for use in findSomeHtml
hrefParser :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m String Source #
Done like this so that it reliably is true link and not false positive
parseOpeningTagF :: forall s (m :: Type -> Type) u. Stream s m Char => String -> (String -> Bool) -> ParsecT s u m ElemHead Source #
parseOpeningTagWhere :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> String -> (String -> Bool) -> ParsecT s u m ElemHead Source #
TODO(galen): make this actually generic, not just for one attr
hrefParser' :: forall s (m :: Type -> Type) u. Stream s m Char => (String -> Bool) -> ParsecT s u m String Source #
Allows parsing with high level predicate
attrValue :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m [Char] Source #
In future should add replace of apostrophe and similar issues to corresponding html representations
attrValuesExist :: [(String, String)] -> [(String, Maybe String)] -> Bool Source #
Both attrValue functions mimic map functionality
attrParser :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m (String, String) Source #
Need lower|UPPER case insensitivity
for generalization sake
attrsParser :: forall s (m :: Type -> Type) u. Stream s m Char => [(String, Maybe String)] -> ParsecT s u m (Either AttrsError (Map String String)) Source #
attrsParserDesc :: forall s (m :: Type -> Type) u. Stream s m Char => [(String, String)] -> ParsecT s u m (Map String String) Source #
parseOpeningTagDesc :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> [(String, String)] -> ParsecT s u m (Elem, Attrs) Source #
digitEq :: String -> String -> Bool Source #
Allows for certain degrees of freedom such as 1 spot off eg 123 vs 1230 (or even (109|22)) | as well as any numerical digit must also be a numerical digit from 0 to 9
parseOpeningTag :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> [(String, Maybe String)] -> ParsecT s u m (Elem, Attrs) Source #
NOTES if href="#" on form -> just means scroll to top
May rename parseOpeningTag to elemHeadParser | -> Case of input tag: ...." DONE ie no innerhtml or end tag | then this would be more efficient or even maybe we should add an option via | a datatype: InnerTextOpts a = DoesntExist --efficient parser | AnyText | ParserText a