Skip to content

Commit

Permalink
Fix rendering channel element within RSS document
Browse files Browse the repository at this point in the history
  • Loading branch information
koral committed Aug 13, 2017
1 parent 995fc4e commit c0e3757
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions Text/RSS/Conduit/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,28 @@ import URI.ByteString

-- | Render the top-level @\<rss\>@ element.
renderRssDocument :: (Monad m) => RssDocument -> Source m Event
renderRssDocument d = tag "rss" (attr "version" . pack . showVersion $ d^.documentVersionL) $ do
textTag "title" $ d^.channelTitleL
textTag "link" $ decodeUtf8 $ withRssURI serializeURIRef' $ d^.channelLinkL
textTag "description" $ d^.channelDescriptionL
optionalTextTag "copyright" $ d^.channelCopyrightL
optionalTextTag "language" $ d^.channelLanguageL
optionalTextTag "managingEditor" $ d^.channelManagingEditorL
optionalTextTag "webMaster" $ d^.channelWebmasterL
forM_ (d^.channelPubDateL) $ dateTag "pubDate"
forM_ (d^.channelLastBuildDateL) $ dateTag "lastBuildDate"
forM_ (d^..channelCategoriesL) renderRssCategory
optionalTextTag "generator" $ d^.channelGeneratorL
forM_ (d^.channelDocsL) $ textTag "docs" . decodeUtf8 . withRssURI serializeURIRef'
forM_ (d^.channelCloudL) renderRssCloud
forM_ (d^.channelTtlL) $ textTag "ttl" . tshow
forM_ (d^.channelImageL) renderRssImage
optionalTextTag "rating" $ d^.channelRatingL
forM_ (d^.channelTextInputL) renderRssTextInput
renderRssSkipHours $ d^.channelSkipHoursL
renderRssSkipDays $ d^.channelSkipDaysL
forM_ (d^..channelItemsL) renderRssItem
renderRssDocument d = tag "rss" (attr "version" . pack . showVersion $ d^.documentVersionL) $
tag "channel" mempty $ do
textTag "title" $ d^.channelTitleL
textTag "link" $ renderRssURI $ d^.channelLinkL
textTag "description" $ d^.channelDescriptionL
optionalTextTag "copyright" $ d^.channelCopyrightL
optionalTextTag "language" $ d^.channelLanguageL
optionalTextTag "managingEditor" $ d^.channelManagingEditorL
optionalTextTag "webMaster" $ d^.channelWebmasterL
forM_ (d^.channelPubDateL) $ dateTag "pubDate"
forM_ (d^.channelLastBuildDateL) $ dateTag "lastBuildDate"
forM_ (d^..channelCategoriesL) renderRssCategory
optionalTextTag "generator" $ d^.channelGeneratorL
forM_ (d^.channelDocsL) $ textTag "docs" . renderRssURI
forM_ (d^.channelCloudL) renderRssCloud
forM_ (d^.channelTtlL) $ textTag "ttl" . tshow
forM_ (d^.channelImageL) renderRssImage
optionalTextTag "rating" $ d^.channelRatingL
forM_ (d^.channelTextInputL) renderRssTextInput
renderRssSkipHours $ d^.channelSkipHoursL
renderRssSkipDays $ d^.channelSkipDaysL
forM_ (d^..channelItemsL) renderRssItem

-- | Render an @\<item\>@ element.
renderRssItem :: (Monad m) => RssItem -> Source m Event
Expand Down

0 comments on commit c0e3757

Please sign in to comment.