Permalink
Browse files

Compatibility with blaze-html-0.5

  • Loading branch information...
1 parent b781b70 commit 8a14e0164d9257bc26d12412d2d28b962be69f56 @jaspervdj jaspervdj committed Apr 21, 2012
Showing with 11 additions and 7 deletions.
  1. +8 −5 src/Text/Blaze/Renderer/XmlHtml.hs
  2. +3 −2 xmlhtml.cabal
View
13 src/Text/Blaze/Renderer/XmlHtml.hs
@@ -3,15 +3,14 @@
--
-- Warning: because this renderer doesn't directly create the output, but
-- rather an XML tree representation, it is impossible to render pre-escaped
--- text. This means that @preEscapedString@ will produce the same output as
--- @string@. This also applies to the functions @preEscapedText@,
--- @preEscapedTextValue@...
+-- text.
--
module Text.Blaze.Renderer.XmlHtml (renderHtml, renderHtmlNodes) where
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
+import Text.Blaze.Html
import Text.Blaze.Internal
import Text.XmlHtml
@@ -52,14 +51,18 @@ fromChoiceString EmptyChoiceString = id
renderNodes :: Html -> [Node] -> [Node]
renderNodes = go []
where
- go :: [(Text, Text)] -> HtmlM b -> [Node] -> [Node]
+ go :: [(Text, Text)] -> MarkupM a -> [Node] -> [Node]
go attrs (Parent tag _ _ content) =
(Element (getText tag) attrs (go [] content []) :)
+ go attrs (CustomParent tag content) =
+ (Element (fromChoiceStringText tag) attrs (go [] content []) :)
go attrs (Leaf tag _ _) =
(Element (getText tag) attrs [] :)
+ go attrs (CustomLeaf tag _) =
+ (Element (fromChoiceStringText tag) attrs [] :)
go attrs (AddAttribute key _ value content) =
go ((getText key, fromChoiceStringText value) : attrs) content
- go attrs (AddCustomAttribute key _ value content) =
+ go attrs (AddCustomAttribute key value content) =
go ((fromChoiceStringText key, fromChoiceStringText value) : attrs)
content
go _ (Content content) = fromChoiceString content
View
5 xmlhtml.cabal
@@ -1,5 +1,5 @@
Name: xmlhtml
-Version: 0.1.7
+Version: 0.2.0
Synopsis: XML parser and renderer with HTML 5 quirks mode
Description: Contains renderers and parsers for both XML and HTML 5
document fragments, which share data structures so that
@@ -821,7 +821,8 @@ Library
Build-depends: base >= 4 && < 5,
blaze-builder >= 0.2 && < 0.4,
- blaze-html >= 0.3.2 && < 0.5,
+ blaze-html >= 0.5 && < 0.6,
+ blaze-markup >= 0.5 && < 0.6,
bytestring >= 0.9 && < 0.10,
containers >= 0.3 && < 0.5,
parsec >= 3.1.2 && < 3.2,

0 comments on commit 8a14e01

Please sign in to comment.