summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Web/Feed.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Hakyll/Web/Feed.hs b/src/Hakyll/Web/Feed.hs
index f40fa8a..6c6fa76 100644
--- a/src/Hakyll/Web/Feed.hs
+++ b/src/Hakyll/Web/Feed.hs
@@ -27,6 +27,7 @@ module Hakyll.Web.Feed
import Hakyll.Core.Compiler
import Hakyll.Core.Compiler.Internal
import Hakyll.Core.Item
+import Hakyll.Core.Util.String (replaceAll)
import Hakyll.Web.Template
import Hakyll.Web.Template.Context
import Hakyll.Web.Template.List
@@ -64,9 +65,14 @@ renderFeed feedPath itemPath config itemContext items = do
feedTpl <- loadTemplate feedPath
itemTpl <- loadTemplate itemPath
- body <- makeItem =<< applyTemplateList itemTpl itemContext' items
+ protectedItems <- mapM (applyFilter protectCDATA) items
+ body <- makeItem =<< applyTemplateList itemTpl itemContext' protectedItems
applyTemplate feedTpl feedContext body
where
+ applyFilter :: (Monad m,Functor f) => (String -> String) -> f String -> m (f String)
+ applyFilter tr str = return $ fmap tr str
+ protectCDATA :: String -> String
+ protectCDATA = replaceAll "]]>" (const "]]&gt;")
-- Auxiliary: load a template from a datafile
loadTemplate path = do
file <- compilerUnsafeIO $ getDataFileName path