module Text.XML.DublinCore.Conduit.Render
( renderElementContributor
, renderElementCoverage
, renderElementCreator
, renderElementDate
, renderElementDescription
, renderElementFormat
, renderElementIdentifier
, renderElementLanguage
, renderElementPublisher
, renderElementRelation
, renderElementRights
, renderElementSource
, renderElementSubject
, renderElementTitle
, renderElementType
) where
import Text.XML.DublinCore
import Conduit
import Data.Text
import Data.Time.Clock
import Data.Time.LocalTime
import Data.Time.RFC3339
import Data.XML.Types
import Text.XML.Stream.Render
dcName :: Text -> Name
dcName string = Name string (Just "http://purl.org/dc/elements/1.1/") (Just namespacePrefix)
renderElementContributor :: Monad m => Text -> Source m Event
renderElementContributor = tag (dcName "contributor") mempty . content
renderElementCoverage :: Monad m => Text -> Source m Event
renderElementCoverage = tag (dcName "coverage") mempty . content
renderElementCreator :: Monad m => Text -> Source m Event
renderElementCreator = tag (dcName "creator") mempty . content
renderElementDate :: Monad m => UTCTime -> Source m Event
renderElementDate = tag (dcName "date") mempty . content . formatTimeRFC3339 . utcToZonedTime utc
renderElementDescription :: Monad m => Text -> Source m Event
renderElementDescription = tag (dcName "description") mempty . content
renderElementFormat :: Monad m => Text -> Source m Event
renderElementFormat = tag (dcName "format") mempty . content
renderElementIdentifier :: Monad m => Text -> Source m Event
renderElementIdentifier = tag (dcName "identifier") mempty . content
renderElementLanguage :: Monad m => Text -> Source m Event
renderElementLanguage = tag (dcName "language") mempty . content
renderElementPublisher :: Monad m => Text -> Source m Event
renderElementPublisher = tag (dcName "publisher") mempty . content
renderElementRelation :: Monad m => Text -> Source m Event
renderElementRelation = tag (dcName "relation") mempty . content
renderElementRights :: Monad m => Text -> Source m Event
renderElementRights = tag (dcName "rights") mempty . content
renderElementSource :: Monad m => Text -> Source m Event
renderElementSource = tag (dcName "source") mempty . content
renderElementSubject :: Monad m => Text -> Source m Event
renderElementSubject = tag (dcName "subject") mempty . content
renderElementTitle :: Monad m => Text -> Source m Event
renderElementTitle = tag (dcName "title") mempty . content
renderElementType :: Monad m => Text -> Source m Event
renderElementType = tag (dcName "type") mempty . content