@@ -27,6 +27,7 @@ module Hakyll.Web.Feed
2727import Hakyll.Core.Compiler
2828import Hakyll.Core.Compiler.Internal
2929import Hakyll.Core.Item
30+import Hakyll.Core.Util.String (replaceAll)
3031import Hakyll.Web.Template
3132import Hakyll.Web.Template.Context
3233import Hakyll.Web.Template.List
@@ -64,9 +65,14 @@ renderFeed feedPath itemPath config itemContext items = do
6465 feedTpl <- loadTemplate feedPath
6566 itemTpl <- loadTemplate itemPath
6667
67− body <- makeItem =<< applyTemplateList itemTpl itemContext' items
68+ protectedItems <- mapM (applyFilter protectCDATA) items
69+ body <- makeItem =<< applyTemplateList itemTpl itemContext' protectedItems
6870 applyTemplate feedTpl feedContext body
6971 where
72+ applyFilter :: (Monad m,Functor f) => (String -> String) -> f String -> m (f String)
73+ applyFilter tr str = return $ fmap tr str
74+ protectCDATA :: String -> String
75+ protectCDATA = replaceAll "]]>" (const "]]>")
7076 -- Auxiliary: load a template from a datafile
7177 loadTemplate path = do
7278 file <- compilerUnsafeIO $ getDataFileName path