diff --git a/src/Text/XML/Writer.hs b/src/Text/XML/Writer.hs index 65e8f66..046d1c8 100644 --- a/src/Text/XML/Writer.hs +++ b/src/Text/XML/Writer.hs @@ -36,6 +36,7 @@ module Text.XML.Writer ) where import Text.XML +import Control.Monad import Control.Monad.Writer.Strict import Data.Default () import qualified Data.DList as DL @@ -58,37 +59,6 @@ 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 - } - --- | Create a simple Document starting with a root element with a doctype. -documentD :: Name -- ^ Root node name - -> Maybe Doctype -- ^ DOCTYPE - -> XML -- ^ Contents - -> Document -documentD name dt children = Document { documentPrologue = Prologue def dt def - , documentRoot = Element name def (render children) - , documentEpilogue = def - } - --- | Create a simple Document starting with a root element with attributes and doctype. -documentAD :: Name -- ^ Root node name - -> [(Name, Text)] -- ^ Attributes - -> Maybe Doctype -- ^ DOCTYPE - -> XML -- ^ Contents - -> Document -documentAD name attrs dt children = Document { documentPrologue = Prologue def dt 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 } @@ -130,11 +100,11 @@ content :: Text -> XML content = node . NodeContent -- | Mass-convert to nodes. --- +-- -- > let array = element "container" $ many "wrapper" [1..3] --- +-- -- Which gives: --- +-- -- > -- > 1 -- > 2 diff --git a/stack.yaml b/stack.yaml index 25f2eec..193dd74 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-20.24 +resolver: lts-22.4 packages: - .