Safe Haskell | None |
---|
- parseHTML :: FilePath -> String -> HTML
- element :: String -> [Attr] -> HTML -> HTML
- text :: String -> HTML
- attr :: String -> String -> Attr
- zero :: HTML
- htmlT :: Monad m => Translate Context m Element a -> Translate Context m Text a -> Translate Context m Syntax a -> ([a] -> x) -> Translate Context m HTML x
- htmlC :: [HTML] -> HTML
- elementT :: Monad m => Translate Context m Attrs a -> Translate Context m HTML b -> (String -> a -> b -> x) -> Translate Context m Element x
- elementC :: String -> Attrs -> HTML -> Element
- textT :: Monad m => (String -> x) -> Translate Context m Text x
- textC :: String -> Text
- attrsT :: Monad m => Translate Context m Attr a -> ([a] -> x) -> Translate Context m Attrs x
- attrsC :: [Attr] -> Attrs
- attrT :: Monad m => (String -> String -> x) -> Translate Context m Attr x
- attrC :: String -> String -> Attr
- getAttr :: MonadCatch m => String -> Translate Context m Element String
- isTag :: Monad m => String -> Translate Context m Element ()
- getTag :: Monad m => Translate Context m Element String
- getAttrs :: Monad m => Translate Context m Element Attrs
- getInner :: Monad m => Translate Context m Element HTML
- anyElementHTML :: MonadCatch m => Translate Context m Element HTML -> Rewrite Context m HTML
- unconcatHTML :: HTML -> [HTML]
- data HTML
- data Element
- data Text
- data Attrs
- data Attr
- data Syntax
- newtype Context = Context [Element]
- data Node
- class Html a where
- injectT' :: (Monad m, Injection a g, g ~ Node) => Translate c m a g
- projectT' :: (Monad m, Injection a g, g ~ Node) => Translate c m g a
- extractT' :: (Monad m, Injection a g, g ~ Node) => Translate c m g b -> Translate c m a b
- promoteT' :: (Monad m, Injection a g, g ~ Node) => Translate c m a b -> Translate c m g b
- extractR' :: (Monad m, Injection a g, g ~ Node) => Rewrite c m g -> Rewrite c m a
- promoteR' :: (Monad m, Injection a g, g ~ Node) => Rewrite c m a -> Rewrite c m g
Reading HTML
HTML Builders
element :: String -> [Attr] -> HTML -> HTMLSource
element
is the main way of generates a element in HTML.
zero
is an empty piece of HTML, which can be used to avoid
the use of the <tag/> form; for example element "br" [] zero will generate both an opener and closer.
zero
is the same as text "".
Primitive Traversal Combinators
htmlT :: Monad m => Translate Context m Element a -> Translate Context m Text a -> Translate Context m Syntax a -> ([a] -> x) -> Translate Context m HTML xSource
htmlT
take arrows that operate over elements, texts, and syntax,
and returns a translate over HTML.
elementT :: Monad m => Translate Context m Attrs a -> Translate Context m HTML b -> (String -> a -> b -> x) -> Translate Context m Element xSource
elementT
take arrows that operate over attributes and (the inner) HTML,
and returns a translate over a single element.
textT :: Monad m => (String -> x) -> Translate Context m Text xSource
textT
takes a Text to bits. The string is fully unescaped (a regular Haskell string)
attrT :: Monad m => (String -> String -> x) -> Translate Context m Attr xSource
promote a function over an attributes components into a translate over Attr
.
Other Combinators and Observers
getAttr :: MonadCatch m => String -> Translate Context m Element StringSource
getAttr
gets the attributes of a specific attribute of a element.
isTag :: Monad m => String -> Translate Context m Element ()Source
isTag
checks the element for a specific element name.
getAttrs :: Monad m => Translate Context m Element AttrsSource
getAttrs
gets the attributes inside a element.
getInner :: Monad m => Translate Context m Element HTMLSource
getInner
gets the HTML inside a element.
anyElementHTML :: MonadCatch m => Translate Context m Element HTML -> Rewrite Context m HTMLSource
lifts mapping of Element
to HTML
over a single level of HTML
sub-nodes.
anyElementHTML
has the property ''anyElementHTML (arr html) = idR''.
This is successful only if any of the sub-translations are successful.
unconcatHTML :: HTML -> [HTML]Source
Flatten into singleton HTMLs. The opposite of mconcat.
Types and Classes
XML/HTML syntax, like <? or <!, or our zero-width space zero
.
Context contains all the containing elements in an inside to outside order
Our universal node type. Only used during generic tree walking and traversals.