Permalink
Browse files

Added and exposed renderFragment function that render an XML document…

… fragment.

Rendering is done without a byte-order-mark or XML declaration.
  • Loading branch information...
1 parent d097b1d commit 1c2862fa18b19c10b1f7184401be04aa37a88727 @sebastiaanvisser sebastiaanvisser committed Feb 27, 2012
Showing with 8 additions and 2 deletions.
  1. +2 −1 src/Text/XmlHtml.hs
  2. +5 −0 src/Text/XmlHtml/XML/Render.hs
  3. +1 −1 xmlhtml.cabal
View
@@ -56,7 +56,8 @@ module Text.XmlHtml (
parseHTML,
-- * Rendering
- render
+ render,
+ XML.renderFragment
) where
------------------------------------------------------------------------------
@@ -24,6 +24,11 @@ render e dt ns = byteOrder
| otherwise = firstNode e (head ns)
`mappend` (mconcat $ map (node e) (tail ns))
+------------------------------------------------------------------------------
+renderFragment :: Encoding -> [Node] -> Builder
+renderFragment _ [] = mempty
+renderFragment e (n:ns) = firstNode e n `mappend` (mconcat $ map (node e) ns)
+
------------------------------------------------------------------------------
xmlDecl :: Encoding -> Builder
View
@@ -1,5 +1,5 @@
Name: xmlhtml
-Version: 0.1.6.2
+Version: 0.1.7
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 wo that

0 comments on commit 1c2862f

Please sign in to comment.