-- | Renderer that supports rendering to xmlhtml forests. This is a port of-- the Hexpat renderer.---- Warning: because this renderer doesn't directly create the output, but-- rather an XML tree representation, it is impossible to render pre-escaped-- text.--moduleText.Blaze.Renderer.XmlHtml(renderHtml,renderHtmlNodes)whereimportData.Text(Text)importqualifiedData.TextasTimportqualifiedData.Text.EncodingasTimportText.Blaze.HtmlimportText.Blaze.InternalimportText.XmlHtml-- | Render a 'ChoiceString' to Text. This is only meant to be used for-- shorter strings, since it is inefficient for large strings.--fromChoiceStringText::ChoiceString->TextfromChoiceStringText(Statics)=getTextsfromChoiceStringText(Strings)=T.packsfromChoiceStringText(Texts)=sfromChoiceStringText(ByteStrings)=T.decodeUtf8sfromChoiceStringText(PreEscapeds)=fromChoiceStringTextsfromChoiceStringText(Externals)=fromChoiceStringTextsfromChoiceStringText(AppendChoiceStringxy)=fromChoiceStringTextx`T.append`fromChoiceStringTextyfromChoiceStringTextEmptyChoiceString=T.empty{-# INLINE fromChoiceStringText #-}-- | Render a 'ChoiceString' to an appending list of nodes--fromChoiceString::ChoiceString->[Node]->[Node]fromChoiceStrings@(Static_)=(TextNode(fromChoiceStringTexts):)fromChoiceStrings@(String_)=(TextNode(fromChoiceStringTexts):)fromChoiceStrings@(Text_)=(TextNode(fromChoiceStringTexts):)fromChoiceStrings@(ByteString_)=(TextNode(fromChoiceStringTexts):)fromChoiceString(PreEscapeds)=fromChoiceStringsfromChoiceString(Externals)=fromChoiceStringsfromChoiceString(AppendChoiceStringxy)=fromChoiceStringx.fromChoiceStringyfromChoiceStringEmptyChoiceString=id{-# INLINE fromChoiceString #-}-- | Render some 'Html' to an appending list of nodes--renderNodes::Html->[Node]->[Node]renderNodes=go[]wherego::[(Text,Text)]->MarkupMa->[Node]->[Node]goattrs(Parenttag__content)=(Element(getTexttag)attrs(go[]content[]):)goattrs(CustomParenttagcontent)=(Element(fromChoiceStringTexttag)attrs(go[]content[]):)goattrs(Leaftag__)=(Element(getTexttag)attrs[]:)goattrs(CustomLeaftag_)=(Element(fromChoiceStringTexttag)attrs[]:)goattrs(AddAttributekey_valuecontent)=go((getTextkey,fromChoiceStringTextvalue):attrs)contentgoattrs(AddCustomAttributekeyvaluecontent)=go((fromChoiceStringTextkey,fromChoiceStringTextvalue):attrs)contentgo_(Contentcontent)=fromChoiceStringcontentgoattrs(Appendh1h2)=goattrsh1.goattrsh2go_Empty=id{-# NOINLINE go #-}{-# INLINE renderNodes #-}-- | Render HTML to an xmlhtml 'Document'--renderHtml::Html->DocumentrenderHtmlhtml=HtmlDocumentUTF8Nothing(renderNodeshtml[]){-# INLINE renderHtml #-}-- | Render HTML to a list of xmlhtml nodes--renderHtmlNodes::Html->[Node]renderHtmlNodes=fliprenderNodes[]