Hi Daniel, Sorry it took so long to respond, but I have been away on holiday a couple of days.
Op ma, 14-08-2006 te 08:04 -0700, schreef Daniel Burrows:
> This has particularly bad effects in a <pre> tag. The fragment
> 'pre [literal "Daniel Burrows <[EMAIL PROTECTED]>"]'
> produces the following output:
>
>
> <pre
> >
> Daniel Burrows
> <
> [EMAIL PROTECTED]
> >
> </pre>
>
> which renders the brackets on separate lines from the email address!
>
> Daniel
This caused by the pretty printer (Text.HaXml.XML.Pretty) which should
be used for XML documents but for HTML documents there is another pretty
printer (Text.HaXml.XML.Html.Pretty) which does pretty print HTML
documents correctly.
The attached code gives me:
<html
><title>What's wrong with HaXML</title
><body
><pre>Daniel Burrows <[EMAIL PROTECTED]></pre></body></html>
This seems to be correct.
Greetings Arjan
module Main where
import Text.PrettyPrint
import Text.XML.HaXml.Combinators
import Text.XML.HaXml.Html.Generate
-- import Text.XML.HaXml.Pretty,
import Text.XML.HaXml.Html.Pretty
import Text.XML.HaXml.Types
import Text.XML.HaXml.Escape
doc :: CFilter
doc = html [
htitle [
literal "What's wrong with HaXML"
],
hbody [
hpre [literal "Daniel Burrows <[EMAIL PROTECTED]>"]
]]
escaper :: Content -> Content
escaper (CElem e) = CElem (xmlEscape stdXmlEscaper e)
escaper x = x
main :: IO ()
main = print $ vcat $ map content $ map escaper $ doc undefined
signature.asc
Description: Dit berichtdeel is digitaal ondertekend

