mirror of
https://github.com/typeable/xml-conduit-writer.git
synced 2024-09-11 16:08:11 +03:00
Add documentA function to Writer.hs
This commit is contained in:
parent
0ebbe8c2ed
commit
6ac50b0b17
@ -58,6 +58,16 @@ document name children = Document { documentPrologue = Prologue def def def
|
||||
, documentEpilogue = def
|
||||
}
|
||||
|
||||
-- | Create a simple Document starting with a root element with attributes.
|
||||
documentA :: Name -- ^ Root node name
|
||||
-> [(Name, Text)] -- ^ Attributes
|
||||
-> XML -- ^ Contents
|
||||
-> Document
|
||||
documentA name attrs children = Document { documentPrologue = Prologue def def def
|
||||
, documentRoot = Element name (M.fromList attrs) (render children)
|
||||
, documentEpilogue = def
|
||||
}
|
||||
|
||||
-- | Render document using xml-conduit's pretty-printer.
|
||||
pprint :: Document -> IO ()
|
||||
pprint = TL.putStrLn . renderText def { rsPretty = True }
|
||||
|
Loading…
Reference in New Issue
Block a user