summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2014-08-25 11:16:34 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2014-08-25 11:16:46 +0200
commit8d22340e7a633bfc8e5dbfa80c97159c796035a6 (patch)
tree45d0ef098c922ff229949035833a665fd97dbfd3 /src/Hakyll/Web
parentb4f264d70e6afac61d6ba6ffb1d6c36120e5b862 (diff)
downloadhakyll-8d22340e7a633bfc8e5dbfa80c97159c796035a6.tar.gz
Don't have TagSoup decode any HTML entities
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r--src/Hakyll/Web/Html.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Hakyll/Web/Html.hs b/src/Hakyll/Web/Html.hs
index a86ac1e..bed7755 100644
--- a/src/Hakyll/Web/Html.hs
+++ b/src/Hakyll/Web/Html.hs
@@ -36,7 +36,7 @@ import Network.URI (isUnreserved, escapeURIString)
--------------------------------------------------------------------------------
-- | Map over all tags in the document
withTags :: (TS.Tag String -> TS.Tag String) -> String -> String
-withTags f = renderTags' . map f . TS.parseTags
+withTags f = renderTags' . map f . parseTags'
--------------------------------------------------------------------------------
@@ -91,6 +91,15 @@ renderTags' = TS.renderTagsOptions TS.RenderOptions
--------------------------------------------------------------------------------
+-- | Customized TagSoup parser: do not decode any entities.
+parseTags' :: String -> [TS.Tag String]
+parseTags' = TS.parseTagsOptions (TS.parseOptions :: TS.ParseOptions String)
+ { TS.optEntityData = \(str, b) -> [TS.TagText $ "&" ++ str ++ [';' | b]]
+ , TS.optEntityAttrib = \(str, b) -> ("&" ++ str ++ [';' | b], [])
+ }
+
+
+--------------------------------------------------------------------------------
-- | Convert a filepath to an URL starting from the site root
--
-- Example: