Safe Haskell | None |
---|---|
Language | Haskell98 |
Haquery is jQuery for Haskell.
Known problems:
Some selectors need explicit * to work: ":eq(0)" does not work but "*:eq(0)" does, same with "> b": "* > b", etc.
- data Attrs
- data Tag
- type Child = Tag
- render :: Tag -> Text
- tag :: Text -> [(Text, Text)] -> [Tag] -> Tag
- doctype :: Text -> Tag
- html :: [(Text, Text)] -> [Tag] -> Tag
- head' :: [(Text, Text)] -> [Tag] -> Tag
- body :: [(Text, Text)] -> [Tag] -> Tag
- div' :: [(Text, Text)] -> [Tag] -> Tag
- text :: Text -> Tag
- form :: [(Text, Text)] -> [Tag] -> Tag
- input :: [(Text, Text)] -> [Tag] -> Tag
- article :: [(Text, Text)] -> [Tag] -> Tag
- a :: [(Text, Text)] -> [Tag] -> Tag
- title :: [(Text, Text)] -> [Tag] -> Tag
- link :: [(Text, Text)] -> [Tag] -> Tag
- script :: [(Text, Text)] -> [Tag] -> Tag
- cat :: Text -> Text -> (Text, Text)
- (-.) :: Text -> Text -> (Text, Text)
- id' :: Text -> (Text, Text)
- class' :: Text -> (Text, Text)
- src :: Text -> (Text, Text)
- href :: Text -> (Text, Text)
- type' :: Text -> (Text, Text)
- style :: Text -> (Text, Text)
- alter :: Text -> (Tag -> Tag) -> Tag -> Tag
- remove :: Text -> Tag -> Tag
- select :: Text -> Tag -> [Tag]
- attrs :: Tag -> Attrs
- attr :: Text -> Tag -> Maybe Text
- children :: Tag -> [Child]
- name :: Tag -> Text
- append :: Tag -> Tag -> Tag
- prepend :: Tag -> Tag -> Tag
- addClass :: Text -> Tag -> Tag
- removeClass :: Text -> Tag -> Tag
- hasClass :: Text -> Tag -> Bool
- toggleClass :: Text -> Tag -> Tag
- parseHtml :: Text -> [Tag]
- matches :: Text -> Tag -> Bool
- parseSelector :: Text -> Selector
- example :: Tag
Types
Rendering
Tag creation
Nested tag functions
alter :: Text -> (Tag -> Tag) -> Tag -> Tag Source #
Apply function on elements matching the selector.
remove :: Text -> Tag -> Tag Source #
Remove tags matching the selector. Does not remove the provided tag itself.
select :: Text -> Tag -> [Tag] Source #
Returns tags matching the selector. Obiously not too useful if you want to alter the given elements, because of Haskell's purity. See alter and remove instead.
Single tag functions
attr :: Text -> Tag -> Maybe Text Source #
Returns an attribute of a tag specified by the first argument.
Manipulation
Parse HTML
Exported for testing purposes only
matches :: Text -> Tag -> Bool Source #
Just for quick and ugly testing. Tests if a (top level) tag satisfies a given selector
parseSelector :: Text -> Selector Source #