-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | HTML rewrite engine, using KURE. -- -- This package provides a uniform KURE-based API for walking over, and -- generating, HTML structures. @package html-kure @version 0.2 module Text.HTML.KURE -- | parsing HTML files. If you want to unparse, use show. parseHTML :: FilePath -> String -> HTML -- | element is the main way of generates a element in HTML. element :: String -> [Attr] -> HTML -> HTML -- | text creates a HTML node with text inside it. text :: String -> HTML -- | build a single Attr. Short version of attrC. attr :: String -> String -> Attr -- | 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 "". zero :: HTML -- | htmlT take arrows that operate over elements, texts, and -- syntax, and returns a translate over 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 -- | mconcat over HTML htmlC :: [HTML] -> HTML -- | elementT take arrows that operate over attributes and (the -- inner) HTML, and returns a translate over a single element. elementT :: Monad m => Translate Context m Attrs a -> Translate Context m HTML b -> (String -> a -> b -> x) -> Translate Context m Element x -- | elementC builds a element from its components. elementC :: String -> Attrs -> HTML -> Element -- | textT takes a Text to bits. The string is fully unescaped (a -- regular Haskell string) textT :: Monad m => (String -> x) -> Translate Context m Text x -- | textC constructs a Text from a fully unescaped string. textC :: String -> Text -- | attrsT promotes a translation over Attr into a -- translation over Attrs. attrsT :: Monad m => Translate Context m Attr a -> ([a] -> x) -> Translate Context m Attrs x -- | join attributes together. attrsC :: [Attr] -> Attrs -- | promote a function over an attributes components into a translate over -- Attr. attrT :: Monad m => (String -> String -> x) -> Translate Context m Attr x -- | Create a single attribute. attrC :: String -> String -> Attr -- | getAttr gets the attributes of a specific attribute of a -- element. getAttr :: MonadCatch m => String -> Translate Context m Element String -- | isTag checks the element for a specific element name. isTag :: Monad m => String -> Translate Context m Element () -- | getTag gets the element name. getTag :: Monad m => Translate Context m Element String -- | getAttrs gets the attributes inside a element. getAttrs :: Monad m => Translate Context m Element Attrs -- | getInner gets the HTML inside a element. getInner :: Monad m => Translate Context m Element HTML -- | 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. anyElementHTML :: MonadCatch m => Translate Context m Element HTML -> Rewrite Context m HTML -- | Flatten into singleton HTMLs. The opposite of mconcat. unconcatHTML :: HTML -> [HTML] -- | The Principal type in DSL. Use show to get the String rendition -- of this type. HTML is concatenated using <>, the -- Monoid mappend. data HTML -- | HTML element with tag and attrs data Element -- | Text (may include escaped text internally) data Text -- | Attributes for a element data Attrs -- | Single attribute data Attr -- | XML/HTML syntax, like <? or <!, or our zero-width space -- zero. data Syntax -- | Context contains all the containing elements in an inside to outside -- order newtype Context Context :: [Element] -> Context -- | Our universal node type. Only used during generic tree walking and -- traversals. data Node class Html a html :: Html a => a -> HTML 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 instance Show Node instance Html Syntax instance Html Text instance Html Element instance Walker Context Node instance Injection Syntax Node instance Injection Attr Node instance Injection Attrs Node instance Injection Text Node instance Injection Element Node instance Injection HTML Node instance Monoid Context instance Monoid HTML instance Show Syntax instance Show Attr instance Show Attrs instance Show Text instance Show Element instance Show HTML