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

PortabilityGHC
Stabilityexperimental
Maintaineralasdair.armstrong@googlemail.com

Text.XHtmlCombinators.Render

Description

 

Synopsis

Documentation

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

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 TextSource

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.