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

Copyright(c) Alasdair Armstrong 2010
LicenseBSD-style
Maintaineralasdair.armstrong@googlemail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell98

Text.XHtmlCombinators.Render

Description

 

Synopsis

Documentation

render :: 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 Light, then use 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, 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.