diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2014-08-25 11:16:34 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2014-08-25 11:16:46 +0200 |
commit | 8d22340e7a633bfc8e5dbfa80c97159c796035a6 (patch) | |
tree | 45d0ef098c922ff229949035833a665fd97dbfd3 /src | |
parent | b4f264d70e6afac61d6ba6ffb1d6c36120e5b862 (diff) | |
download | hakyll-8d22340e7a633bfc8e5dbfa80c97159c796035a6.tar.gz |
Don't have TagSoup decode any HTML entities
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Web/Html.hs | 11 |
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: |