xhtml-combinators-0.2.2: Fast and easy to use XHTML combinators.

Portability | GHC
Stability | experimental
Maintainer | alasdair.armstrong@googlemail.com

Text.XHtmlCombinators.Render

Description

Synopsis

- render :: Content c => XHtml c -> Text
- renderPretty :: Content c => XHtml c -> Text
- renderT :: (Functor t, Monad t, Content c) => XHtmlT t c -> t Text
- renderPrettyT :: (Functor t, Monad t, Content c) => XHtmlT t c -> t Text

# Documentation

render :: Content c => XHtml c -> Text

renderPretty :: Content c => XHtml c -> Text

renderT :: (Functor t, Monad t, Content c) => XHtmlT t c -> t Text

Quickly render a xhtml page to text.

This function will render the entire page on a single line, which is somewhat unreadable. On the plus side, it's relatively fast.

renderPrettyT :: (Functor t, Monad t, Content c) => XHtmlT t c -> t Text

Renders a pretty xhtml page with readable indentation.

What we do is turn the document from `Text` into a `String`, parse that string with `Text.XML.Light`, then use `Text.XML.Light'`s pretty printing function to render it, before finally packing it again. It probably goes without saying, but this function is incredibly inefficient!

Also, `Text.XML.Light` will render the document as proper XML, which is fine only if you're not trying to pass of your page as text/html.

It also has a tendency to turn escaped characters back into their unescaped counterparts, so it's probably best to only use this for debugging.